* [PATCH] drivers: ide: Fix mostly harmless off-by-one hardcoded value
@ 2014-11-27 21:57 Rasmus Villemoes
2014-12-12 20:31 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Rasmus Villemoes @ 2014-11-27 21:57 UTC (permalink / raw)
To: David S. Miller; +Cc: Rasmus Villemoes, linux-ide, linux-kernel
The string "IOMEGA Clik!" has length 12, not 11. Using strstarts
avoids the error-prone hardcoding of the prefix length. For
consistency, also change the occurence just above.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
drivers/ide/ide-floppy.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 3d42043..8c6363c 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -487,7 +487,7 @@ static void ide_floppy_setup(ide_drive_t *drive)
* it. It should be fixed as of version 1.9, but to be on the safe side
* we'll leave the limitation below for the 2.2.x tree.
*/
- if (!strncmp((char *)&id[ATA_ID_PROD], "IOMEGA ZIP 100 ATAPI", 20)) {
+ if (strstarts((char *)&id[ATA_ID_PROD], "IOMEGA ZIP 100 ATAPI")) {
drive->atapi_flags |= IDE_AFLAG_ZIP_DRIVE;
/* This value will be visible in the /proc/ide/hdx/settings */
drive->pc_delay = IDEFLOPPY_PC_DELAY;
@@ -498,7 +498,7 @@ static void ide_floppy_setup(ide_drive_t *drive)
* Guess what? The IOMEGA Clik! drive also needs the above fix. It makes
* nasty clicking noises without it, so please don't remove this.
*/
- if (strncmp((char *)&id[ATA_ID_PROD], "IOMEGA Clik!", 11) == 0) {
+ if (strstarts((char *)&id[ATA_ID_PROD], "IOMEGA Clik!")) {
blk_queue_max_hw_sectors(drive->queue, 64);
drive->atapi_flags |= IDE_AFLAG_CLIK_DRIVE;
/* IOMEGA Clik! drives do not support lock/unlock commands */
--
2.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drivers: ide: Fix mostly harmless off-by-one hardcoded value
2014-11-27 21:57 [PATCH] drivers: ide: Fix mostly harmless off-by-one hardcoded value Rasmus Villemoes
@ 2014-12-12 20:31 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-12-12 20:31 UTC (permalink / raw)
To: linux; +Cc: linux-ide, linux-kernel
From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Date: Thu, 27 Nov 2014 22:57:29 +0100
> The string "IOMEGA Clik!" has length 12, not 11. Using strstarts
> avoids the error-prone hardcoding of the prefix length. For
> consistency, also change the occurence just above.
>
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-12-12 20:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-27 21:57 [PATCH] drivers: ide: Fix mostly harmless off-by-one hardcoded value Rasmus Villemoes
2014-12-12 20:31 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).