lkml.org 
[lkml]   [2014]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] scsi: mpt2sas: mpt2sas_base.c: Cleaning up missing null-terminate after strncpy call
From
Hi

A little embarrassing, but I actually did not know that there was a
better replacement for strncpy.

Sorry, but I will send a new platch based on strlcpy instead then.

Will investigate cover letter then to.


Best regards
Rickard Strandqvist


2014-06-05 0:01 GMT+02:00 Joe Perches <joe@perches.com>:
> 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';
>
>


\
 
 \ /
  Last update: 2014-06-05 01:01    [W:0.571 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site