ata: libata-eh: Remove unnecessary snprintf arithmetic
PATCH 1/1 ata: libata-eh: Remove unnecessary snprintf arithmetic
Remove an unnecessary arithmetic operation from a call to snprintf, because the size parameter of snprintf includes the trailing null byte.
---
drivers/ata/libata-eh.c +1 -1
@@ -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) {
Hello,
drivers/ata/libata-eh.c static void ata_eh_link_report(struct ata_link *link) · line 2435
Quoted 12 lines · Levente Kurusa
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 <[email protected]>---
drivers/ata/libata-eh.c +0
-0@@ -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.
Signature · 1 line
tejun
2013-10-29 19:53 keltezéssel, Tejun Heo írta:
Quoted 14 lines
Hello,
Quoted 11 lines · Levente Kurusa
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 <[email protected]>---
drivers/ata/libata-eh.c +0
-0@@ -2427,7 +2434,7 @@ static void ata_eh_link_report(struct ata_link *link)
Quoted 4 lines
drivers/ata/libata-eh.c static void ata_eh_link_report(struct ata_link *link) · line 2435
Quoted 1 line
drivers/ata/libata-eh.c +0
-0memset (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.
Signature · 2 lines
Regards, Levente Kurusa