public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sg: fix integer overflow
@ 2014-01-24 16:34 Mikulas Patocka
  2014-01-24 16:36 ` Douglas Gilbert
  2014-01-24 16:56 ` James Bottomley
  0 siblings, 2 replies; 5+ messages in thread
From: Mikulas Patocka @ 2014-01-24 16:34 UTC (permalink / raw)
  To: Doug Gilbert; +Cc: linux-scsi, James E.J. Bottomley

On alpha, USER_HZ may be higher than HZ. This results in integer overflow
in MULDIV.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org

---
 drivers/scsi/sg.c |    2 ++
 1 file changed, 2 insertions(+)

Index: linux-3.13/drivers/scsi/sg.c
===================================================================
--- linux-3.13.orig/drivers/scsi/sg.c	2014-01-20 21:44:02.000000000 +0100
+++ linux-3.13/drivers/scsi/sg.c	2014-01-24 17:28:02.000000000 +0100
@@ -856,8 +856,10 @@ sg_ioctl(struct file *filp, unsigned int
 			return result;
 		if (val < 0)
 			return -EIO;
+#if USER_HZ < HZ
 		if (val >= MULDIV (INT_MAX, USER_HZ, HZ))
 		    val = MULDIV (INT_MAX, USER_HZ, HZ);
+#endif
 		sfp->timeout_user = val;
 		sfp->timeout = MULDIV (val, HZ, USER_HZ);
 

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

end of thread, other threads:[~2014-01-24 17:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-24 16:34 [PATCH] sg: fix integer overflow Mikulas Patocka
2014-01-24 16:36 ` Douglas Gilbert
2014-01-24 16:56 ` James Bottomley
2014-01-24 17:04   ` Mikulas Patocka
2014-01-24 17:28     ` Mikulas Patocka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox