public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Johannes Thumshirn <jthumshirn@suse.de>
To: Alan <gnomes@lxorguk.ukuu.org.uk>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH] lpfc: fix missing zero termination in debugfs
Date: Tue, 16 Feb 2016 07:52:36 +0100	[thread overview]
Message-ID: <20160216065236.GF18134@c203.arch.suse.de> (raw)
In-Reply-To: <20160215191142.19028.9220.stgit@localhost.localdomain>

On Mon, Feb 15, 2016 at 07:11:56PM +0000, Alan wrote:
> If you feed 32 bytes in then the kstrtoull() doesn't receive a terminated
> string so will run off the end.
> 
> Signed-off-by: Alan Cox <alan@linux.intel.com>
> ---
>  drivers/scsi/lpfc/lpfc_debugfs.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
> index 25aa9b9..a63542b 100644
> --- a/drivers/scsi/lpfc/lpfc_debugfs.c
> +++ b/drivers/scsi/lpfc/lpfc_debugfs.c
> @@ -1054,11 +1054,11 @@ lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf,
>  {
>  	struct dentry *dent = file->f_path.dentry;
>  	struct lpfc_hba *phba = file->private_data;
> -	char dstbuf[32];
> +	char dstbuf[33];
>  	uint64_t tmp = 0;
>  	int size;
>  
> -	memset(dstbuf, 0, 32);
> +	memset(dstbuf, 0, 33);
>  	size = (nbytes < 32) ? nbytes : 32;
>  	if (copy_from_user(dstbuf, buf, size))
>  		return 0;
> 

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>

-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2016-02-16  6:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-15 19:11 [PATCH] lpfc: fix missing zero termination in debugfs Alan
2016-02-16  6:52 ` Johannes Thumshirn [this message]
2016-02-18  0:17 ` Martin K. Petersen

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=20160216065236.GF18134@c203.arch.suse.de \
    --to=jthumshirn@suse.de \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=linux-scsi@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