All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Colin King <colin.king@canonical.com>
Cc: Johannes Thumshirn <jth@kernel.org>,
	"James E . J . Bottomley" <jejb@linux.vnet.ibm.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	fcoe-devel@open-fcoe.org, linux-scsi@vger.kernel.org,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scsi: fcoe: sanity check string size for store_ctrl_mode option
Date: Wed, 22 Mar 2017 19:39:45 +0000	[thread overview]
Message-ID: <20170322193945.GK32449@mwanda> (raw)
In-Reply-To: <20170322140137.28485-1-colin.king@canonical.com>

On Wed, Mar 22, 2017 at 02:01:37PM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Reading and writing to mode[count - 1] implies the count should not
> be less than 1 so add a sanity check for this.
> 
> Detected with CoverityScan, CID#1357345 ("Overflowed array index write")
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

This is harmless, of course, but count can't be zero.  This is a sysfs
file so we test for zero size writes in sysfs_kf_write() and return
early.

regards,
dan carpenter


WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Colin King <colin.king@canonical.com>
Cc: Johannes Thumshirn <jth@kernel.org>,
	"James E . J . Bottomley" <jejb@linux.vnet.ibm.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	fcoe-devel@open-fcoe.org, linux-scsi@vger.kernel.org,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scsi: fcoe: sanity check string size for store_ctrl_mode option
Date: Wed, 22 Mar 2017 22:39:45 +0300	[thread overview]
Message-ID: <20170322193945.GK32449@mwanda> (raw)
In-Reply-To: <20170322140137.28485-1-colin.king@canonical.com>

On Wed, Mar 22, 2017 at 02:01:37PM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Reading and writing to mode[count - 1] implies the count should not
> be less than 1 so add a sanity check for this.
> 
> Detected with CoverityScan, CID#1357345 ("Overflowed array index write")
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

This is harmless, of course, but count can't be zero.  This is a sysfs
file so we test for zero size writes in sysfs_kf_write() and return
early.

regards,
dan carpenter


  reply	other threads:[~2017-03-22 19:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-22 14:01 [PATCH] scsi: fcoe: sanity check string size for store_ctrl_mode option Colin King
2017-03-22 19:39 ` Dan Carpenter [this message]
2017-03-22 19:39   ` Dan Carpenter
2017-03-22 19:42   ` Colin Ian King
2017-03-23 11:45     ` Dan Carpenter
2017-03-23 11:45       ` Dan Carpenter

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=20170322193945.GK32449@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=colin.king@canonical.com \
    --cc=fcoe-devel@open-fcoe.org \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=jth@kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.