mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sergio Perez Gonzalez <sperezglz@gmail.com>
To: zhoubinbin@loongson.cn, ulf.hansson@linaro.org
Cc: Sergio Perez Gonzalez <sperezglz@gmail.com>,
	linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] mmc: loongson2: prevent integer overflow in ret variable
Date: Mon,  7 Jul 2025 12:55:41 -0600	[thread overview]
Message-ID: <20250707185545.46275-1-sperezglz@gmail.com> (raw)

In loongson2_mmc_dll_mode_init(), `ret` variable is declared
as u32 but it is expected to hold an int value.

Fixes: d0f8e961deae ("mc: loongson2: Add Loongson-2K2000 SD/SDIO/eMMC controller driver")
Reported-by: https://scan7.scan.coverity.com/#/project-view/53936/11354?selectedIssue=1644958

Signed-off-by: Sergio Perez Gonzalez <sperezglz@gmail.com>
---
 drivers/mmc/host/loongson2-mmc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/loongson2-mmc.c b/drivers/mmc/host/loongson2-mmc.c
index 515ccf834f0a..ba6bb8fd5535 100644
--- a/drivers/mmc/host/loongson2-mmc.c
+++ b/drivers/mmc/host/loongson2-mmc.c
@@ -485,7 +485,8 @@ static irqreturn_t loongson2_mmc_irq(int irq, void *devid)
 
 static void loongson2_mmc_dll_mode_init(struct loongson2_mmc_host *host)
 {
-	u32 val, pad_delay, delay, ret;
+	u32 val, pad_delay, delay;
+	int ret;
 
 	regmap_update_bits(host->regmap, LOONGSON2_MMC_REG_SEL,
 			   LOONGSON2_MMC_SEL_DATA, LOONGSON2_MMC_SEL_DATA);
-- 
2.43.0


             reply	other threads:[~2025-07-07 18:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-07 18:55 Sergio Perez Gonzalez [this message]
2025-07-08  1:15 ` Binbin Zhou
2025-07-09 14:02 ` Ulf Hansson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250707185545.46275-1-sperezglz@gmail.com \
    --to=sperezglz@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@linaro.org \
    --cc=zhoubinbin@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®