lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 6 Mar 2014 16:19:19 +0900
From:	DaeSeok Youn <daeseok.youn@...il.com>
To:	Tobias Klauser <tklauser@...tanz.ch>
Cc:	Greg KH <gregkh@...uxfoundation.org>,
	devel <devel@...verdev.osuosl.org>,
	Shaun Laing <shaun@...source.ca>,
	"sachin.kamat" <sachin.kamat@...aro.org>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	Dulshani Gunawardhana <dulshani.gunawardhana89@...il.com>,
	"ying.xue" <ying.xue@...driver.com>,
	David Miller <davem@...emloft.net>
Subject: Re: [PATCH 7/7] staging: cxt1e1: remove unneeded a value

2014-03-05 19:13 GMT+09:00 Tobias Klauser <tklauser@...tanz.ch>:
> On 2014-03-05 at 02:24:22 +0100, Daeseok Youn <daeseok.youn@...il.com> wrote:
>>
>> It doesn't need to assign name array address to np pointer.
>>
>> Signed-off-by: Daeseok Youn <daeseok.youn@...il.com>
>> ---
>>  drivers/staging/cxt1e1/linux.c |    5 ++---
>>  1 files changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/staging/cxt1e1/linux.c b/drivers/staging/cxt1e1/linux.c
>> index 5bb42ae..cae8c66 100644
>> --- a/drivers/staging/cxt1e1/linux.c
>> +++ b/drivers/staging/cxt1e1/linux.c
>> @@ -205,15 +205,14 @@ status_t
>>  c4_wq_port_init(mpi_t *pi)
>>  {
>>
>> -     char        name[16], *np;  /* NOTE: name of the queue limited by system
>> +     char        name[16];  /* NOTE: name of the queue limited by system
>>                                    * to 10 characters */
>>
>>       if (pi->wq_port)
>>               return 0;                   /* already initialized */
>>
>> -     np = name;
>>       memset(name, 0, 16);
>
> This isn't necessary since s{,n}printf() adds a terminating '\0'.
Yes, I have looked at lib/vsprintf.c. I found it adds null to a string
in the end of vsnprintf() function.
I will remove memset() line.

>
>> -     sprintf(np, "%s%d", pi->up->devname, pi->portnum); /* IE pmcc4-01) */
>> +     sprintf(name, "%s%d", pi->up->devname, pi->portnum); /* IE pmcc4-01) */
>
> Better use snprintf() here, even if the comment above claims the name
> never to be no longer than 10 characters.
OK. I will replace sprintf with snprintf() and set a string length to "10".

Thanks for review.
Daeseok Youn.
>
> Cheers
> Tobias
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists