Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1323200

Re: [PATCH] staging: goldfish: use div64_s64 instead of do_div

Path csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
Newsgroups linux.kernel
Subject Re: [PATCH] staging: goldfish: use div64_s64 instead of do_div
Date Mon, 01 Feb 2016 16:00:03 +0100
Message-ID <qXo7p-4jK-19@gated-at.bofh.it> (permalink)
References <qXk3L-1dK-1@gated-at.bofh.it>
Organization Intel Corporation
X-Mailer Claws Mail 3.13.1 (GTK+ 2.24.29; x86_64-redhat-linux-gnu)
MIME-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 18
X-Original-Cc gregkh@linuxfoundation.org, Greg Hackmann <ghackmann@google.com>, Jin Qian <jinqian@android.com>, Alan Cox <alan@linux.intel.com>, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org
X-Original-Date Mon, 1 Feb 2016 14:54:57 +0000
X-Original-Message-ID <20160201145457.7879d53f@lxorguk.ukuu.org.uk>
X-Original-References <1676170.0qik6mzm6D@wuerfel>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1323200

Show key headers only | View raw


On Mon, 01 Feb 2016 11:33 +0100
Arnd Bergmann <arnd@arndb.de> wrote:

> The goldfish nand driver divides a signed 64-bit number (loff_t)
> in multiple places using the do_div() function. This has always
> been unreliable but now produces a compiler warning (since 4.5-rc1):
> 
> goldfish/goldfish_nand.c: In function 'goldfish_nand_erase':
> goldfish/goldfish_nand.c:107:91: error: comparison of distinct pointer types lacks a cast [-Werror]
> goldfish/goldfish_nand.c: In function 'goldfish_nand_read_oob':
> goldfish/goldfish_nand.c:145:91: error: comparison of distinct pointer types lacks a cast [-Werror]
> 
> This changes the code to the equivalent div_s64{,_rem} that
> works correctly for negative numbers (which we should never
> get here).

We can't get negatives as you say so surely the right fix is a cast or to
fix mtd->writesize ?

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] staging: goldfish: use div64_s64 instead of do_div Arnd Bergmann <arnd@arndb.de> - 2016-02-01 11:40 +0100
  Re: [PATCH] staging: goldfish: use div64_s64 instead of do_div One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk> - 2016-02-01 16:00 +0100
    Re: [PATCH] staging: goldfish: use div64_s64 instead of do_div Arnd Bergmann <arnd@arndb.de> - 2016-02-01 17:20 +0100
  Re: [PATCH] staging: goldfish: use div64_s64 instead of do_div One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk> - 2016-02-02 17:40 +0100

csiph-web