From: Dan Carpenter <dan.carpenter@oracle.com>
To: "David S. Miller" <davem@davemloft.net>,
Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [PATCH] ide: Prevent some negative shifts in ide_set_ignore_cable()
Date: Fri, 30 Oct 2020 14:51:02 +0300 [thread overview]
Message-ID: <20201030115102.GE3251003@mwanda> (raw)
Shifting by a negative number is undefined. These values come from the
module parameter, so it's not a big deal from a practical perspective.
Fixes: 9fd91d959f1a ("ide: add "ignore_cable" parameter (take 2)")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/ide/ide.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 9a9c64fd1032..dcfb8a187c46 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -338,7 +338,7 @@ static int ide_set_ignore_cable(const char *s, const struct kernel_param *kp)
if (sscanf(s, "%d:%d", &i, &j) != 2 && sscanf(s, "%d", &i) != 1)
return -EINVAL;
- if (i >= MAX_HWIFS || j < 0 || j > 1)
+ if (i < 0 || i >= MAX_HWIFS || j < 0 || j > 1)
return -EINVAL;
if (j)
--
2.28.0
reply other threads:[~2020-10-30 14:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20201030115102.GE3251003@mwanda \
--to=dan.carpenter@oracle.com \
--cc=bzolnier@gmail.com \
--cc=davem@davemloft.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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