From nobody Sun Nov 24 08:04:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1725041176; cv=none; d=zohomail.com; s=zohoarc; b=bZbL+t/iAev/BZEVX9Qa8W3UpFIpczhaq0Dg0Yry9VNubGjvISBNVcjuI3hy8lJM1mPBQJXxCLl/zpZx9RiFFltOo0EZO74+uIi0T7UUVH7u10franPIxOb/+8DI5TUI1gig9JWcy0IDPJlrojpEXg9TmuE1m0RytryU+aEyMYY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725041176; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=87fChB+xc7soA2EPRxfWWl3aNqmrKrcv5Gq87Q1dcqo=; b=BsyVthaHE9gZ3v9s8rCZM38IvqbHCIV+aTU9omqg4eP8uw2BdKFDDZkkstQ7lLDra8vq2T5VirVAXWRf1A8CvMaibhtbOiIRNW/TsTq8Wsdp3kGzbw8nG3IYDKzD5IKCACXnG9dlZgjr/LLzgYcYjc8xlYZ3WbiyLEt+OYVZ4ms= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1725041176410997.2384933573559; Fri, 30 Aug 2024 11:06:16 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: AGHT+IFPrpNb9+Tkdye1l5pkQBg/gM2yevwxGKkYvtwY1e6R/IawqdDblLVkBlCqLkg0i+B+DXhrFw== 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) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1725041178603116600 Content-Type: text/plain; charset="utf-8" In aspeed_gpio_update() we calculate "mask =3D 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=C3=A9dric 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, GPIO= Sets *regs, diff &=3D mode_mask; if (diff) { for (gpio =3D 0; gpio < ASPEED_GPIOS_PER_SET; gpio++) { - uint32_t mask =3D 1 << gpio; + uint32_t mask =3D 1U << gpio; =20 /* If the gpio needs to be updated... */ if (!(diff & mask)) { --=20 2.34.1