* [patch] pktcdvd: silence static checker warning
@ 2013-05-16 8:11 Dan Carpenter
2013-05-29 13:37 ` Jiri Kosina
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2013-05-16 8:11 UTC (permalink / raw)
To: Jiri Kosina; +Cc: linux-kernel, kernel-janitors
Static checkers complain about widening the binary "not" operations here
because sectors are u64 and "(pd)->settings.size" is unsigned int.
It unintentionally clears the high 32 bits of the sector. This means
that the driver won't work for devices with over 2TB of space. Since
this is a DVD drive, we're unlikely to reach that limit, but we may as
well silence the warning.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 898fa74..09142c4 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -83,7 +83,8 @@
#define MAX_SPEED 0xffff
-#define ZONE(sector, pd) (((sector) + (pd)->offset) & ~((pd)->settings.size - 1))
+#define ZONE(sector, pd) (((sector) + (pd)->offset) & \
+ ~(sector_t)((pd)->settings.size - 1))
static DEFINE_MUTEX(pktcdvd_mutex);
static struct pktcdvd_device *pkt_devs[MAX_WRITERS];
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] pktcdvd: silence static checker warning
2013-05-16 8:11 [patch] pktcdvd: silence static checker warning Dan Carpenter
@ 2013-05-29 13:37 ` Jiri Kosina
0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2013-05-29 13:37 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-kernel, kernel-janitors
On Thu, 16 May 2013, Dan Carpenter wrote:
> Static checkers complain about widening the binary "not" operations here
> because sectors are u64 and "(pd)->settings.size" is unsigned int.
> It unintentionally clears the high 32 bits of the sector. This means
> that the driver won't work for devices with over 2TB of space. Since
> this is a DVD drive, we're unlikely to reach that limit, but we may as
> well silence the warning.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
> index 898fa74..09142c4 100644
> --- a/drivers/block/pktcdvd.c
> +++ b/drivers/block/pktcdvd.c
> @@ -83,7 +83,8 @@
>
> #define MAX_SPEED 0xffff
>
> -#define ZONE(sector, pd) (((sector) + (pd)->offset) & ~((pd)->settings.size - 1))
> +#define ZONE(sector, pd) (((sector) + (pd)->offset) & \
> + ~(sector_t)((pd)->settings.size - 1))
>
> static DEFINE_MUTEX(pktcdvd_mutex);
> static struct pktcdvd_device *pkt_devs[MAX_WRITERS];
Makes sense. Applied, thanks Dan.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-05-29 13:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-16 8:11 [patch] pktcdvd: silence static checker warning Dan Carpenter
2013-05-29 13:37 ` Jiri Kosina
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox