From patchwork Wed Jan 12 17:20:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 1579256 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=KLTdEdpo; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JYvZj3szCz9s1l for ; Thu, 13 Jan 2022 04:25:01 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1D8EA83520; Wed, 12 Jan 2022 18:22:24 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="KLTdEdpo"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CE73A83178; Wed, 12 Jan 2022 18:22:11 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D18F1834B1 for ; Wed, 12 Jan 2022 18:21:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CC96261770; Wed, 12 Jan 2022 17:21:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F3C5C36AE5; Wed, 12 Jan 2022 17:21:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642008116; bh=u6eFUyzikJFEwp4bfU30PIe6SgEemDX2edHXJeN6iCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KLTdEdpoF69jtzMtO7Ffoo9cGAsurJngwM+6CxiVnCeu0FKCFSG7g+gDI4nH1X7Si ywzPGlC95GrPzGe+GIRS0OihS026QD07H2axVoR494ZTa8CaO/GeXCbzlHF5WChaMQ /xZqTLV42O6ZqdFuujhIZMj12h0cW3qW5svK9TSJMRo4Jt0ZEQcExSNhTE7Dwlp9ud nH/dREadiNMW/HAM//nzUyDCgWP4DJJxZ/xHij3OMxNn8o9kYnfXWn3EYU0q0mw2QD +P28VyxeZWw1usCGZwEg8AZSzz1/SF5NMFiGSdbvG+MsoT7oWUbttBFV0DPJ7PkFdI ZOCy/Ksy91AEw== Received: by pali.im (Postfix) id C9B8C768; Wed, 12 Jan 2022 18:21:55 +0100 (CET) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Stefan Roese , =?utf-8?q?Marek_Beh=C3=BAn?= , Chris Packham Cc: u-boot@lists.denx.de Subject: [PATCH u-boot-marvell v2 17/20] tools: kwbimage: Do not cast const pointers to non-const pointers Date: Wed, 12 Jan 2022 18:20:51 +0100 Message-Id: <20220112172054.5961-18-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220112172054.5961-1-pali@kernel.org> References: <20211221155416.8557-1-pali@kernel.org> <20220112172054.5961-1-pali@kernel.org> MIME-Version: 1.0 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 Avoid casting const to non-const. Signed-off-by: Pali Rohár Reviewed-by: Marek Behún Reviewed-by: Stefan Roese --- 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;