mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Cc: Nagalakshmi Nandigama <Nagalakshmi.Nandigama@lsi.com>,
	Sreekanth Reddy <Sreekanth.Reddy@lsi.com>,
	support@lsi.com,
	"James E.J. Bottomley" <JBottomley@parallels.com>,
	DL-MPTFusionLinux@lsi.com, linux-scsi@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scsi: mpt2sas: mpt2sas_base.c:  Cleaning up missing null-terminate after strncpy call
Date: Wed, 04 Jun 2014 15:01:23 -0700	[thread overview]
Message-ID: <1401919283.26329.7.camel@joe-AO725> (raw)
In-Reply-To: <1401917775-3222-1-git-send-email-rickard_strandqvist@spectrumdigital.se>

On Wed, 2014-06-04 at 23:36 +0200, Rickard Strandqvist wrote:
> Added a guaranteed null-terminate after call to strncpy.

Next time you submit a patch series like this
can you please use a cover letter?

That way I can reply to the cover letter with
a comment about the series instead of multiple
replies to various patches.

I think all of these should be using strlcpy not
strncpy.

> diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
[]
> @@ -2097,7 +2097,8 @@ _base_display_ioc_capabilities(struct MPT2SAS_ADAPTER *ioc)
>  	u32 bios_version;
>  
>  	bios_version = le32_to_cpu(ioc->bios_pg3.BiosVersion);
> -	strncpy(desc, ioc->manu_pg0.ChipName, 16);
> +	strncpy(desc, ioc->manu_pg0.ChipName, sizeof(desc));
> +	desc[sizeof(desc) - 1] = '\0';



  reply	other threads:[~2014-06-04 22:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-04 21:36 Rickard Strandqvist
2014-06-04 22:01 ` Joe Perches [this message]
2014-06-04 22:25   ` Rickard Strandqvist
2014-06-04 22:28 ` James Bottomley
2014-06-06 13:02   ` Rickard Strandqvist

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=1401919283.26329.7.camel@joe-AO725 \
    --to=joe@perches.com \
    --cc=DL-MPTFusionLinux@lsi.com \
    --cc=JBottomley@parallels.com \
    --cc=Nagalakshmi.Nandigama@lsi.com \
    --cc=Sreekanth.Reddy@lsi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=rickard_strandqvist@spectrumdigital.se \
    --cc=support@lsi.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

all inboxes | Powered by JetHome®