From patchwork Fri Aug 30 18:05:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 824024 Delivered-To: patch@linaro.org Received: by 2002:a5d:48c1:0:b0:367:895a:4699 with SMTP id p1csp913162wrs; Fri, 30 Aug 2024 11:06:15 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWfRA+rBoIA68IW4I2cDl/URQEuPnuY8Kh2c65iAcfgZJ4vcDhyfrq7ooEYC25LuzEhyBgE1g==@linaro.org X-Google-Smtp-Source: AGHT+IG2N6+tyO5HeHLSEiFn7113O5lF6P00jIWFSAyuauxtf6JHWIgE4QcTIYiUzAW8e+jeEnqb X-Received: by 2002:a05:6214:2b91:b0:6bf:7968:1405 with SMTP id 6a1803df08f44-6c33e6c149cmr71579666d6.46.1725041175557; Fri, 30 Aug 2024 11:06:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725041175; cv=none; d=google.com; s=arc-20160816; b=TH5HSg6beucDpXGj+suyIVfeAtCsA6Z1EiqNLqPg1/hm7qIlrzBomlC9OmvowhgAku lJ1ErcNai+/iA1SGkno/Q/LNyJzSTDG4KvVQMQTGlmPaK6LBW9E21j/V2k5EnSlS2T6i bzGDMkcN0d0MmM/fzvB1YG4PSVt7CnlW9vDRLcgqIuiPusdH1Jk7rTzuewXv0xivNK7x lSB47mMsLkFr7p+EFHxtp+pHB4XVWAlrNUxhW+woEI+HzYanM0KHPuC9VYuVYvKDweQn SpWyWSyVvcfytN6mHYy210DWHAGdbhGX6vUE+u6ICVOw/7SzEaqEfPFbD1Ed9sS7NfjM TMUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=87fChB+xc7soA2EPRxfWWl3aNqmrKrcv5Gq87Q1dcqo=; fh=EXtIvegx1GbPpaYUyOMLhe8bfWhHd9DTLkO2CVb9fkU=; b=nOXhls+W6r4V/HoPJOnYCjAozLVgFpJCX/7MrQlwzgwO4yaXwDvY+QelY6k074ppHk 7sTO0lohN3ExBRWS2KICTtMs2Bs6gENMxlHNwvJJdmCch72HzkZTgpfVHCdE3qZmzwvZ 1sh/Vvb+2LQ8Hy8ARMo7jlH0M2zq7Uted5C/Pie0PEuN6X1U13pWVfZiYcAEzzfUtm7Z 2KpEvpfyyH7jmioFXtwS9hDjFXfYYB8grcJptjKTMRV/QrKefW4Y2B1Kaz/PUzREowIC pedu65Gg1AzBm1UqpM9kO5TzKM7qAeV7lal4AWF+jh8ucGthvJI+CBRJsrjSHFtB/DDJ PytA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="FIqM/CbS"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6c340db0496si20937536d6.448.2024.08.30.11.06.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Aug 2024 11:06:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="FIqM/CbS"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk607-0003CR-Fa; Fri, 30 Aug 2024 14:05:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk5zw-00037E-8O for qemu-devel@nongnu.org; Fri, 30 Aug 2024 14:05:27 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sk5zt-0006Yi-39 for qemu-devel@nongnu.org; Fri, 30 Aug 2024 14:05:23 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-42bb8cf8a5bso14259375e9.2 for ; Fri, 30 Aug 2024 11:05:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725041118; x=1725645918; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=87fChB+xc7soA2EPRxfWWl3aNqmrKrcv5Gq87Q1dcqo=; b=FIqM/CbS4br1G/WLewwDxMx2ivRf0XUfGdn+p1D6P5q86Hm0k2B0DK4YCyDw7Bq9F8 FWd9ikntxQ81Hd0j3kg3UoNgOnIUbkft+X8dbCRBFxk4DDBtmZ+vXaZs6gYaaKbNLn7i j09saCLvJ+SxGEd/rPGOQVXXdpI/fkRkpkgqSQoRlCw5zk7Lbtev51S8kBlPEKd+5bhe E+l4AFhDtN6GCFW2Nkg9Fsdfv+CWCwlz+tgCYbrrSadgQErbenBz6KC7PecLtv0Jxhhy Q2MOnQYjmkzaaIRZiwPVm/afkwmSeTFxfznDY7LJDbJNyXG7cyZBcj+78m5R8z9g9bnu ZRkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725041118; x=1725645918; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=87fChB+xc7soA2EPRxfWWl3aNqmrKrcv5Gq87Q1dcqo=; b=YuQOc6nsG67xx2/h1MuLs3oAsjsXME+5hwk6s+jxeMyaBe+eHtFiZIqz2WS8JnpHBw s2XelG4CFh9p4s0duriIzjDEDJyAFLBsLWM/U6SmzjJ8CHlvobbqRCRCp305gzIQLsns k0VP8ZL7nozZ9ofk8SwbrXSXb2W3fpfKslc0UQ0LspK2K7V3AjIef/ob4zqfQN0V3A3j PEnWUOlCLen+Q7wOcHxSTiVRiT2Q+oNoTMyVJY3Xby5+Ibm81Mxx/qgh/tq89nSOurRW K3bbuCf8TM2h7Vb0luk0HsO9u1pybaiEy7xjuyj+wf8A1ChJsksM9aXVr494sL7aYAKZ Ki6w== X-Forwarded-Encrypted: i=1; AJvYcCXOuPzXLYJQzgDIOiDTi4nJmE3ceC91bKkt797m+7e5b+aMi2t4v7pwXeIxikGQ8MriaXu8rDfHoQ+5@nongnu.org X-Gm-Message-State: AOJu0YyP0NIMhWx5R/feVoJVytn5J28A9hynhnWro8xhrqlJuM7l/9EB crgrxuu/3hweeip3qks4eUJoZuUvHv3ugez1QfwJyO7wjh3wL3U9mLWel1if8tY= X-Received: by 2002:a05:600c:3c93:b0:426:67f0:b4eb with SMTP id 5b1f17b1804b1-42bb0244482mr54257325e9.2.1725041117971; Fri, 30 Aug 2024 11:05:17 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bbe79f545sm18969555e9.2.2024.08.30.11.05.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Aug 2024 11:05:17 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: =?utf-8?q?C=C3=A9dric_Le_Goater?= Subject: [PATCH] hw/gpio/aspeed_gpio: Avoid shift into sign bit Date: Fri, 30 Aug 2024 19:05:16 +0100 Message-Id: <20240830180516.2103062-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org In aspeed_gpio_update() we calculate "mask = 1 << gpio", where gpio can be between 0 and 31. Coverity complains about this because 1 << 31 won't fit in a signed integer. For QEMU this isn't an error because we enable -fwrapv, but we can keep Coverity happy by doing the shift on unsigned numbers. Resolves: Coverity CID 1547742 Signed-off-by: Peter Maydell Reviewed-by: Cédric Le Goater --- Very minor but I'm just fixing a few easy issues on a Friday evening :-) hw/gpio/aspeed_gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/gpio/aspeed_gpio.c b/hw/gpio/aspeed_gpio.c index 6474bb8de5b..d6ccf63a2ff 100644 --- a/hw/gpio/aspeed_gpio.c +++ b/hw/gpio/aspeed_gpio.c @@ -281,7 +281,7 @@ static void aspeed_gpio_update(AspeedGPIOState *s, GPIOSets *regs, diff &= mode_mask; if (diff) { for (gpio = 0; gpio < ASPEED_GPIOS_PER_SET; gpio++) { - uint32_t mask = 1 << gpio; + uint32_t mask = 1U << gpio; /* If the gpio needs to be updated... */ if (!(diff & mask)) {