From mboxrd@z Thu Jan 1 00:00:00 1970 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 4A8FFC433FE for ; Wed, 12 Jan 2022 17:24:27 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4480D834C4; Wed, 12 Jan 2022 18:22:18 +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="DOSol/Z+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8363D832CD; Wed, 12 Jan 2022 18:22:07 +0100 (CET) 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 6F1E48347A for ; Wed, 12 Jan 2022 18:21:53 +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 67C6C61843; Wed, 12 Jan 2022 17:21:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15300C36AE5; Wed, 12 Jan 2022 17:21:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642008112; bh=LI7a3CkY3pwmPp1rVInrDG0dW2WbPceiJ5E19wsjjvs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DOSol/Z+XagKD84LBimlr4vqjY0F2NeqzxWF7YX4E2TMc/eETnRfntIvazc9VvHWE +keCpIWC1sY2JcJnihZ4t0l4J9bivVeyzgk3sFn3vHzwHfsoFUPUqTFeWR7Wv8+bv0 9rsIHkO5KN7P8hezM5BRwb1F3SrRO2pAxJoO51PP1refXGZpM+YkuUKvNYWmEXJF8z ywaIkSYfb8lbpNKAoxOBmTcNiWcUoBj+poTILXgkdZsFVIUGDHhoXklgkIkjrcOEWW hcufoRGykFlMuCH5/mRwnDC78Le3wdBMyho021nUYZ0LMFld4S3YE8LhxLm/xyLGeL uGmz8NuqqeMFw== Received: by pali.im (Postfix) id C0109768; Wed, 12 Jan 2022 18:21:51 +0100 (CET) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Stefan Roese , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Chris Packham Cc: u-boot@lists.denx.de Subject: [PATCH u-boot-marvell v2 14/20] tools: kwbimage: Add missing check for maximal value for DATA_DELAY Date: Wed, 12 Jan 2022 18:20:48 +0100 Message-Id: <20220112172054.5961-15-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 Content-Type: text/plain; charset=UTF-8 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 Data delay is stored as 8-bit number in kwbimage structure. Ensure the given value is at most 255. Signed-off-by: Pali Rohár Reviewed-by: Marek Behún --- tools/kwbimage.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/kwbimage.c b/tools/kwbimage.c index 7c2106006ad7..2de8c371c12a 100644 --- a/tools/kwbimage.c +++ b/tools/kwbimage.c @@ -1659,6 +1659,10 @@ static int image_create_config_parse_oneline(char *line, el->regdata_delay = REGISTER_SET_HDR_OPT_DELAY_SDRAM_SETUP; else el->regdata_delay = REGISTER_SET_HDR_OPT_DELAY_MS(strtoul(value1, NULL, 10)); + if (el->regdata_delay > 255) { + fprintf(stderr, "Maximal DATA_DELAY is 255\n"); + return -1; + } break; case IMAGE_CFG_BAUDRATE: el->baudrate = strtoul(value1, NULL, 10); -- 2.20.1