Thread (42 messages) 42 messages, 7 authors, 2016-03-16

[PATCH V2 2/3] scsi: fix compiler warning for sg

From: arnd@arndb.de (Arnd Bergmann)
Date: 2015-11-10 10:11:25
Also in: linux-arm-msm, linux-scsi, lkml

On Monday 09 November 2015 22:53:17 Timur Tabi wrote:
Sinan Kaya wrote:
quoted
The code says it is using these macros for small integers only which
can't overflow. I was trying to get rid of compiler warning and it seems
to have disappeared.
I would double-check the assembly code, if I were you.  I don't like it 
when warnings just go away like that.

Besides, we *should* be using do_div() for 64-bit division.
I stared at this code for some time and couldn't figure out whether it
is actually safe or not. The point here is that it doesn't actually do
a 64-bit division here:

	MULDIV(INT_MAX, USER_HZ, HZ)

where all arguments are 32bit and it tries to figure out whether the
ioctl argument is too big to fit into a 32-bit number

but it does a 'long' division that happens to be 64-bit long on
architectures with the respective register size when it then does

	sfp->timeout = MULDIV (val, HZ, USER_HZ);

to scale up the argument from USER_HZ to the possibly larger in-kernel
HZ value. So I think it's safe as is, but I'm still not entirely sure.

	Arnd
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help