From patchwork Wed Nov 4 20:21:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 56006 Delivered-To: patch@linaro.org Received: by 10.112.61.134 with SMTP id p6csp12829lbr; Wed, 4 Nov 2015 12:25:28 -0800 (PST) X-Received: by 10.107.7.86 with SMTP id 83mr5887647ioh.48.1446668728899; Wed, 04 Nov 2015 12:25:28 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id o85si3631623ioi.173.2015.11.04.12.25.28 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Nov 2015 12:25:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-mtd-bounces+patch=linaro.org@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@linaro_org.20150623.gappssmtp.com Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zu4Z3-0003ip-GC; Wed, 04 Nov 2015 20:21:49 +0000 Received: from mail-qg0-x233.google.com ([2607:f8b0:400d:c04::233]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zu4Yz-0003ZD-DP for linux-mtd@lists.infradead.org; Wed, 04 Nov 2015 20:21:46 +0000 Received: by qgem9 with SMTP id m9so50227697qge.1 for ; Wed, 04 Nov 2015 12:21:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:user-agent:mime-version :content-type; bh=/QExNtmJTTLxtlqbCk794d9SlzH3TCssJJ0/vF1hzLQ=; b=XACQQe1N1GGmmv594p496bX8Pydc1Jk6xjESqY5zACM/eMlxWHi7s5B3a23rdOXQ0N zIOJIVi0qLfkvDNRd7LaJu8WjNL8zTkL58/+ri1e5fN5MJfREMyUqljGNin7PDgzOmW5 HvvT5TYU6S9zIUR0MrznZ2jiAK2fvbt589ItVUNRUAob6eADqFg/ioeUd/NCKlHV5EaP 2kO99013PxW1ucjZ7QY1BUXmsfVVMnFhIbjut3wSru105iolQQ5ky7xyV3gK0+SnnqS2 7JxeDNUObQVKMpw7+teNQgSXMB4wzIAfMd+5owzYo8hPDthOm2+QEdx8eWqV0f47aAaP QZCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:user-agent :mime-version:content-type; bh=/QExNtmJTTLxtlqbCk794d9SlzH3TCssJJ0/vF1hzLQ=; b=ccAd93rPi/lvKMpGWQM6+D6GOpfVac0ZGXBIALHBLt1cp14Glttod85dd61878LX7r ZDdXNjR5i3vMot91J/Os5qx72JtncYBebaIhQrH4l9pz704iL/uTgMqyo8kR41LDXW5c 924lnmS2aWsXAjo8p5FTKPzMl6FQxS22r4Xg5BtiGMHbelTP+kiZVQxzjKsu7I31mjEj KmVQ8eJTOPX9MnOtLNuSraTww3TdR02KVacol3WibbdXykyjwqd0pmfjyco9GsgRcsoi WFm4L7mh50AfQ82YmE1PnytDu+fVBn4oToPD4ThUVZc9FuCzef5NopiCP+r3U+jF9X6C /CgQ== X-Gm-Message-State: ALoCoQlCu0bor2ddxEnpmWeilzpZlSVQGSZay5DorYE/IW8PAB6WC1eyt14y6F8yYyYOFNMNDkbu X-Received: by 10.140.106.7 with SMTP id d7mr3593996qgf.98.1446668483395; Wed, 04 Nov 2015 12:21:23 -0800 (PST) Received: from xanadu.home (modemcable065.157-23-96.mc.videotron.ca. [96.23.157.65]) by smtp.gmail.com with ESMTPSA id j34sm749431qkh.39.2015.11.04.12.21.22 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Nov 2015 12:21:22 -0800 (PST) Date: Wed, 4 Nov 2015 15:21:21 -0500 (EST) From: Nicolas Pitre To: David Woodhouse , Brian Norris Subject: mtd/sm_ftl.c: fix wrong do_div() usage Message-ID: User-Agent: Alpine 2.20 (LFD 67 2015-01-07) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151104_122145_641114_D283A612 X-CRM114-Status: GOOD ( 10.22 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2607:f8b0:400d:c04:0:0:0:233 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-mtd@lists.infradead.org Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org do_div() is meant to be used with an unsigned dividend. Signed-off-by: Nicolas Pitre ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/sm_ftl.c b/drivers/mtd/sm_ftl.c index c23184a47f..b096f8bb05 100644 --- a/drivers/mtd/sm_ftl.c +++ b/drivers/mtd/sm_ftl.c @@ -206,9 +206,10 @@ static loff_t sm_mkoffset(struct sm_ftl *ftl, int zone, int block, int boffset) } /* Breaks offset into parts */ -static void sm_break_offset(struct sm_ftl *ftl, loff_t offset, +static void sm_break_offset(struct sm_ftl *ftl, loff_t loffset, int *zone, int *block, int *boffset) { + u64 offset = loffset; *boffset = do_div(offset, ftl->block_size); *block = do_div(offset, ftl->max_lba); *zone = offset >= ftl->zone_count ? -1 : offset;