All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ide-cd: Fix signedness warning
@ 2011-05-30  7:13 Connor Hansen
  2011-05-31 22:23 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Connor Hansen @ 2011-05-30  7:13 UTC (permalink / raw)
  To: David S. Miller; +Cc: Borislav Petkov, linux-ide, linux-kernel, Connor Hansen

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

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

because queue_logical_block_size() returns unsigned short but hard_sect
is defined as int. Fix that no matter how low the potential for this
becoming a bug is.

Signed-off-by: Connor Hansen <cmdkhh@gmail.com>
---
 drivers/ide/ide-cd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 6e5123b..c1de54a 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1309,7 +1309,7 @@ static int ide_cdrom_probe_capabilities(ide_drive_t *drive)
 /* standard prep_rq_fn that builds 10 byte cmds */
 static int ide_cdrom_prep_fs(struct request_queue *q, struct request *rq)
 {
-	int hard_sect = queue_logical_block_size(q);
+	unsigned short hard_sect = queue_logical_block_size(q);
 	long block = (long)blk_rq_pos(rq) / (hard_sect >> 9);
 	unsigned long blocks = blk_rq_sectors(rq) / (hard_sect >> 9);
 
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/2] ide-cd: Fix signedness warning
  2011-05-30  7:13 [PATCH 1/2] ide-cd: Fix signedness warning Connor Hansen
@ 2011-05-31 22:23 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2011-05-31 22:23 UTC (permalink / raw)
  To: cmdkhh; +Cc: bp, linux-ide, linux-kernel

From: Connor Hansen <cmdkhh@gmail.com>
Date: Mon, 30 May 2011 00:13:32 -0700

> One of the legit warnings 'make W=3 drivers/ide/ide-cd.o´ generates is
> 
> drivers/ide/ide-cd.c: In function .ide_cdrom_prep_fs.:
> drivers/ide/ide-cd.c:1314: warning: conversion to .unsigned int. from .int. may change the sign of the result
> 
> because queue_logical_block_size() returns unsigned short but hard_sect
> is defined as int. Fix that no matter how low the potential for this
> becoming a bug is.
> 
> Signed-off-by: Connor Hansen <cmdkhh@gmail.com>

An 'int' can always hold as large a value as an "unsigned short" can ever
hold, so there is no real problem here.

I'm not applying this.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-05-31 22:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-30  7:13 [PATCH 1/2] ide-cd: Fix signedness warning Connor Hansen
2011-05-31 22:23 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.