Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752442AbbKJKLZ (ORCPT ); Tue, 10 Nov 2015 05:11:25 -0500 Received: from mout.kundenserver.de ([212.227.126.131]:57695 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752411AbbKJKLV (ORCPT ); Tue, 10 Nov 2015 05:11:21 -0500 From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Cc: Timur Tabi , Sinan Kaya , Andy Shevchenko , Doug Gilbert , "James E.J. Bottomley" , linux-scsi , jcm@redhat.com, Andy Gross , "linux-kernel@vger.kernel.org" , cov@codeaurora.org, linux-arm-msm@vger.kernel.org Subject: Re: [PATCH V2 2/3] scsi: fix compiler warning for sg Date: Tue, 10 Nov 2015 11:09:48 +0100 Message-ID: <6427533.oLIG8d5C7c@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <5641783D.3030108@codeaurora.org> References: <1447034266-28003-1-git-send-email-okaya@codeaurora.org> <564177D7.7070103@codeaurora.org> <5641783D.3030108@codeaurora.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:GvQCw8XFd/P0wFnv5qqWaX6RA+RljCuKABt7PFah223XDPxAf0e uFvES4U1xHe6yVdpcvKtaB1bXoA7VTzO9n2OPvcASEL88Fog1eJYEZR1QFI3T8lYWg1aYj2 VNTo6Zry+FKWRapJbQwyvGE+DL3DEZZzXgqsQDZUq7iLs72zF7A1aWd11Mr2FzlLcxCryGw 6rXZ5qwP5j5qOxAlBD7lA== X-UI-Out-Filterresults: notjunk:1;V01:K0:sCct0DPoeQE=:4Bxd7uvt1nTe3LHspEcmFO EZS5CFho7OOU6nzTK5NPtJ8PyU+r7bzjKMLKaNXGfl4YqhAgTLxkETkYojcrWqnye1ORLHD0N fvHgLvSQNem0TmAydjm8B9SmYijsoaiOgeDn4o5aylXcvP9ACkpmUnmFtXw3CCvVu4Fl0iRoe vNjdJS7Xzgypj9ZrUpSbE6Ures7bS/lz0mpvEKcbrc8qoX95di3Oepk6XY1jYgHpTRGMiTbpx +VbbSfLmFoxHBx0nID2BQca2npNwvCR7U78yuh5sT2TJ0gH6tHCnlvklDPvHs2s5oQlMuweW0 HiACbibbrp3ekdIln6gMZqYYkhleyo2KNiauBMkwmDD6Ke7i0/6+eSnQu7PrOMLWWokq9WVpC 2des6gF93vlnJIf1cVCl3FiM9doeHTg9t7HUu6gWkYfUbNyDfVQDFvL8GlbON4BVT/KjgKFQ1 rr5Vb2IVr29NO3DedR/ld6AyuwWIfIM680DxRBt7HzR590usKiKiZ23cGfkUKKPPAsdpivoN5 MFxduE/oIdo/5DfY5oVkwT0DoGsG7eMZ6rR6R6rcn2rFm3SLu8/lLHonk/MVKK7XCFQ4LqV2q 229pGGFA5xfSvjY8PednULRNsE9tensFbQnrgsDdlRKA2THBxdmRl7phXxHo+fnRN4m/1RkgV y52Ph/am/0+KjiaZHJi8ZXdIB8Q6NgMX3UpI+SpgG0PLOEphNLTFAJJnhhre/UzffI4HOiZGR PR20prZd9Gp1gjgq Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1328 Lines: 35 On Monday 09 November 2015 22:53:17 Timur Tabi wrote: > Sinan Kaya wrote: > > > > 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/