Skip to contentSkip to conversation

ide-cd: Fix another signedness warning

PATCH In review Connor Hansen 2 participants 2 messages May 30, 2011 – May 31, 2011 libata

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 ide-cd: Fix another signedness warning

One of the legit warnings 'make W=3 drivers/ide/ide-cd.o generates is

drivers/ide/ide-cd.c: In function ide_cd_queue_pc:
drivers/ide/ide-cd.c:451:3: warning: conversion to unsigned int from
int may change the sign of the result

timeout is passed as an int, but is declared as an unsigned int in struct request in include/linux/blkdev.h

---
 drivers/ide/ide-cd.c |    2 +-
 drivers/ide/ide-cd.h |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/ide/ide-cd.c +1 -1
index c1de54a..f509db5 100644
@@ -422,7 +422,7 @@ static void ide_cd_request_sense_fixup(ide_drive_t *drive, struct ide_cmd *cmd)
 
 int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd,
 		    int write, void *buffer, unsigned *bufflen,
-		    struct request_sense *sense, int timeout,
+		    struct request_sense *sense, unsigned int timeout,
 		    unsigned int cmd_flags)
 {
 	struct cdrom_info *info = drive->driver_data;
drivers/ide/ide-cd.h +1 -1
index 1efc936..24292ee 100644
@@ -101,7 +101,7 @@ void ide_cd_log_error(const char *, struct request *, struct request_sense *);
 
 /* ide-cd.c functions used by ide-cd_ioctl.c */
 int ide_cd_queue_pc(ide_drive_t *, const unsigned char *, int, void *,
-		    unsigned *, struct request_sense *, int, unsigned int);
+		    unsigned *, struct request_sense *, unsigned int, unsigned int);
 int ide_cd_read_toc(ide_drive_t *, struct request_sense *);
 int ide_cdrom_get_capabilities(ide_drive_t *, u8 *);
 void ide_cdrom_update_speed(ide_drive_t *, u8 *);
Signature · 1 line
1.7.4.4
#1 lore raw

From: Connor Hansen <[email protected]>
Date: Mon, 30 May 2011 00:26:58 -0700

Quoted 10 lines

One of the legit warnings 'make W=3 drivers/ide/ide-cd.o generates is

drivers/ide/ide-cd.c: In function ide_cd_queue_pc:
drivers/ide/ide-cd.c:451:3: warning: conversion to unsigned int from
int may change the sign of the result

timeout is passed as an int, but is declared as an unsigned int in struct request in include/linux/blkdev.h

This is beyond academic and may in fact introduce strange things.

All except one call site passes "0" for the timeout.

And that one call site passes packet_command->timeout from userspace which is an 'int'.

I'm not applying this.