* [PATCH trivial] ata: libata-eh: Remove unnecessary snprintf arithmetic
@ 2013-10-29 18:38 Levente Kurusa
2013-10-29 18:53 ` Tejun Heo
0 siblings, 1 reply; 3+ messages in thread
From: Levente Kurusa @ 2013-10-29 18:38 UTC (permalink / raw)
To: Tejun Heo, Linux IDE/ATA Dev, LKML
Remove an unnecessary arithmetic operation from a call to snprintf, because
the size parameter of snprintf includes the trailing null byte.
Signed-off-by: Levente Kurusa <levex@linux.com>
---
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index f9476fb..b7c4146 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -2427,7 +2434,7 @@ static void ata_eh_link_report(struct ata_link *link)
memset(tries_buf, 0, sizeof(tries_buf));
if (ap->eh_tries < ATA_EH_MAX_TRIES)
- snprintf(tries_buf, sizeof(tries_buf) - 1, " t%d",
+ snprintf(tries_buf, sizeof(tries_buf), " t%d",
ap->eh_tries);
if (ehc->i.dev) {
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH trivial] ata: libata-eh: Remove unnecessary snprintf arithmetic
2013-10-29 18:38 [PATCH trivial] ata: libata-eh: Remove unnecessary snprintf arithmetic Levente Kurusa
@ 2013-10-29 18:53 ` Tejun Heo
2013-10-29 18:58 ` Levente Kurusa
0 siblings, 1 reply; 3+ messages in thread
From: Tejun Heo @ 2013-10-29 18:53 UTC (permalink / raw)
To: Levente Kurusa; +Cc: Linux IDE/ATA Dev, LKML
Hello,
On Tue, Oct 29, 2013 at 07:38:38PM +0100, Levente Kurusa wrote:
> Remove an unnecessary arithmetic operation from a call to snprintf, because
> the size parameter of snprintf includes the trailing null byte.
>
> Signed-off-by: Levente Kurusa <levex@linux.com>
> ---
> diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
> index f9476fb..b7c4146 100644
> --- a/drivers/ata/libata-eh.c
> +++ b/drivers/ata/libata-eh.c
> @@ -2427,7 +2434,7 @@ static void ata_eh_link_report(struct ata_link *link)
>
> memset(tries_buf, 0, sizeof(tries_buf));
While at it, can you please remove the above and just initialize the
buffer to "" on definition?
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH trivial] ata: libata-eh: Remove unnecessary snprintf arithmetic
2013-10-29 18:53 ` Tejun Heo
@ 2013-10-29 18:58 ` Levente Kurusa
0 siblings, 0 replies; 3+ messages in thread
From: Levente Kurusa @ 2013-10-29 18:58 UTC (permalink / raw)
To: Tejun Heo; +Cc: Linux IDE/ATA Dev, LKML
2013-10-29 19:53 keltezéssel, Tejun Heo írta:
> Hello,
>
> On Tue, Oct 29, 2013 at 07:38:38PM +0100, Levente Kurusa wrote:
>> Remove an unnecessary arithmetic operation from a call to snprintf, because
>> the size parameter of snprintf includes the trailing null byte.
>>
>> Signed-off-by: Levente Kurusa <levex@linux.com>
>> ---
>> diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
>> index f9476fb..b7c4146 100644
>> --- a/drivers/ata/libata-eh.c
>> +++ b/drivers/ata/libata-eh.c
>> @@ -2427,7 +2434,7 @@ static void ata_eh_link_report(struct ata_link *link)
>>
>> memset(tries_buf, 0, sizeof(tries_buf));
>
> While at it, can you please remove the above and just initialize the
> buffer to "" on definition?
Sure, sending v2 in a moment.
--
Regards,
Levente Kurusa
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-10-29 18:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-29 18:38 [PATCH trivial] ata: libata-eh: Remove unnecessary snprintf arithmetic Levente Kurusa
2013-10-29 18:53 ` Tejun Heo
2013-10-29 18:58 ` Levente Kurusa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox