Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 60E7EC433F5 for ; Thu, 13 Jan 2022 06:45:38 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B8D958344C; Thu, 13 Jan 2022 07:45:36 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1642056336; bh=ijC55yH86GNa6Pgts8K0Za16y6/8HeOblXTkDXZdcZQ=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=vb0LubH1al0WPvNMiHC559a/BMZmncjyop3pe1zXtkIGWhVUY5rDXl+KWJc6F/3PL yDjyc/IfdzsCByPXguWeXYu3Az/rQUbC5ccA3NiDHtT40B6LRhhcV05QV57oqWywbX h0fkxdWAjGCxSpMhPAYgs9Jc6Zg7ipJLq2uDhcYDgffJW+BkwmErC5oWM+y8yTEq2S uowIXSLM5VYa+OUepD6P8LDFx0pWFwrjqx6DN0cU8kCpZcT4Fn3AaJ/oJcqkvmrKhk CaXiNFHBqeNkXt4EQ0B4Q+XIxQMC8+ogG1Ie+9QGfrDcT+gS0xeXXKMW/b42SXxtUN 9lrvWnhQI/Gzw== Received: by phobos.denx.de (Postfix, from userid 109) id 3E32183461; Thu, 13 Jan 2022 07:45:36 +0100 (CET) Received: from mout-u-204.mailbox.org (mout-u-204.mailbox.org [IPv6:2001:67c:2050:1::465:204]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 03E188340A for ; Thu, 13 Jan 2022 07:45:34 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sr@denx.de Received: from smtp1.mailbox.org (unknown [91.198.250.123]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-204.mailbox.org (Postfix) with ESMTPS id 4JZFLP6ZyZzQlGr; Thu, 13 Jan 2022 07:45:33 +0100 (CET) Message-ID: <33bb7aef-9c66-8a95-397e-fa54cac812c5@denx.de> Date: Thu, 13 Jan 2022 07:45:30 +0100 MIME-Version: 1.0 Subject: Re: [PATCH u-boot-marvell v2 17/20] tools: kwbimage: Do not cast const pointers to non-const pointers Content-Language: en-US To: =?UTF-8?Q?Pali_Roh=c3=a1r?= , =?UTF-8?Q?Marek_Beh=c3=ban?= , Chris Packham Cc: u-boot@lists.denx.de References: <20211221155416.8557-1-pali@kernel.org> <20220112172054.5961-1-pali@kernel.org> <20220112172054.5961-18-pali@kernel.org> From: Stefan Roese In-Reply-To: <20220112172054.5961-18-pali@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On 1/12/22 18:20, Pali Rohár wrote: > Avoid casting const to non-const. > > Signed-off-by: Pali Rohár > Reviewed-by: Marek Behún Reviewed-by: Stefan Roese Thanks, Stefan > --- > tools/kwbimage.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/tools/kwbimage.h b/tools/kwbimage.h > index 8d37357e5abd..c000cba4b8d1 100644 > --- a/tools/kwbimage.h > +++ b/tools/kwbimage.h > @@ -235,11 +235,11 @@ static inline int opt_hdr_v1_valid_size(const struct opt_hdr_v1 *ohdr, > { > uint32_t ohdr_size; > > - if ((void *)(ohdr + 1) > mhdr_end) > + if ((const void *)(ohdr + 1) > mhdr_end) > return 0; > > ohdr_size = opt_hdr_v1_size(ohdr); > - if (ohdr_size < 8 || (void *)((uint8_t *)ohdr + ohdr_size) > mhdr_end) > + if (ohdr_size < 8 || (const void *)((const uint8_t *)ohdr + ohdr_size) > mhdr_end) > return 0; > > return 1; > Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de