Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753911AbdDKOff (ORCPT ); Tue, 11 Apr 2017 10:35:35 -0400 Received: from mail-wm0-f48.google.com ([74.125.82.48]:36619 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753691AbdDKOfc (ORCPT ); Tue, 11 Apr 2017 10:35:32 -0400 Subject: Re: [PATCH 2/3] lightnvm: fix type checks on rrpc To: =?UTF-8?Q?Javier_Gonz=c3=a1lez?= References: <1491920338-2348-1-git-send-email-javier@cnexlabs.com> <1491920338-2348-4-git-send-email-javier@cnexlabs.com> Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?Q?Javier_Gonz=c3=a1lez?= From: =?UTF-8?Q?Matias_Bj=c3=b8rling?= Message-ID: Date: Tue, 11 Apr 2017 16:35:29 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <1491920338-2348-4-git-send-email-javier@cnexlabs.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1138 Lines: 32 On 04/11/2017 04:18 PM, Javier González wrote: > sector_t is always unsigned, therefore avoid < 0 checks on it. > > Signed-off-by: Javier González > --- > drivers/lightnvm/rrpc.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/lightnvm/rrpc.c b/drivers/lightnvm/rrpc.c > index 5dba544..cf0e28a 100644 > --- a/drivers/lightnvm/rrpc.c > +++ b/drivers/lightnvm/rrpc.c > @@ -817,7 +817,7 @@ static int rrpc_read_ppalist_rq(struct rrpc *rrpc, struct bio *bio, > > for (i = 0; i < npages; i++) { > /* We assume that mapping occurs at 4KB granularity */ > - BUG_ON(!(laddr + i >= 0 && laddr + i < rrpc->nr_sects)); > + BUG_ON(!(laddr + i < rrpc->nr_sects)); > gp = &rrpc->trans_map[laddr + i]; > > if (gp->rblk) { > @@ -846,7 +846,7 @@ static int rrpc_read_rq(struct rrpc *rrpc, struct bio *bio, struct nvm_rq *rqd, > if (!is_gc && rrpc_lock_rq(rrpc, bio, rqd)) > return NVM_IO_REQUEUE; > > - BUG_ON(!(laddr >= 0 && laddr < rrpc->nr_sects)); > + BUG_ON(!(laddr < rrpc->nr_sects)); > gp = &rrpc->trans_map[laddr]; > > if (gp->rblk) { > Thanks. Applied for 4.12.