public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Levente Kurusa <levex@linux.com>
To: Yu Chen <chyyuu@gmail.com>, linux-kernel@vger.kernel.org
Cc: megaraidlinux@lsi.com, xiaoqixue_1 <xiaoqixue_1@163.com>,
	范文良 <fanwlexca@gmail.com>
Subject: Re: [PATCH] scsi: integer overflow in megadev_ioctl()
Date: Fri, 13 Dec 2013 18:01:58 +0100	[thread overview]
Message-ID: <52AB3D86.2040706@linux.com> (raw)
In-Reply-To: <CAAdffVGw9Fz1AzAWs5y2943R3JsTvaCvQN1kipCdpeK+Guv_JQ@mail.gmail.com>

Hi,

On 12/13/2013 05:55 PM, Yu Chen wrote:
>  drivers/scsi/megaraid.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
> index 816db12..41bbc21 100644
> --- a/drivers/scsi/megaraid.c
> +++ b/drivers/scsi/megaraid.c
> @@ -3113,7 +3113,8 @@ megadev_ioctl(struct file *filep, unsigned int
> cmd, unsigned long arg)
>   /*
>   * Which adapter
>   */
> - if( (adapno = GETADAP(uioc.adapno)) >= hba_count )
> +                adapno = GETADAP(uioc.adapno);
> + if( adapno >= hba_count || adapno < 0 )
>   return (-ENODEV);

Wouldn't returning -EINVAL be better? For hba_count I understand that
-ENODEV is returned but for adapno being a passed variable, I would
suggest returning -EINVAL.

-- 
Regards,
Levente Kurusa

  reply	other threads:[~2013-12-13 17:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-13 16:55 [PATCH] scsi: integer overflow in megadev_ioctl() Yu Chen
2013-12-13 17:01 ` Levente Kurusa [this message]
2013-12-13 17:31   ` Yu Chen
2013-12-13 17:43     ` Levente Kurusa
  -- strict thread matches above, loose matches on Subject: below --
2013-12-13 18:41 Chen.Yu
2013-12-13 18:59 ` Måns Rullgård
2013-12-14  0:35   ` Yu Chen
2013-12-14  0:51 Chen.Yu

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=52AB3D86.2040706@linux.com \
    --to=levex@linux.com \
    --cc=chyyuu@gmail.com \
    --cc=fanwlexca@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=megaraidlinux@lsi.com \
    --cc=xiaoqixue_1@163.com \
    /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