Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp6113199imd; Wed, 31 Oct 2018 07:04:06 -0700 (PDT) X-Google-Smtp-Source: AJdET5dRbZnCBQHYvHRd3KWM0GQqGeGHg5zKi+ydZaFLu/NxZ9VAk0Be19mBp2V1RUJbOFpTc7EY X-Received: by 2002:a63:5558:: with SMTP id f24-v6mr620578pgm.37.1540994646761; Wed, 31 Oct 2018 07:04:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540994646; cv=none; d=google.com; s=arc-20160816; b=CmG3K2lJlzy4zs67ol3Q6u/1jRkxhF12ea1liMH84PIBqFKCHX2j77wrsCe1s7rUY3 ayMpAVCgB0DTk2ZAR2OAFub3c062UYSTUKAjxbGQv6Ca2b+iqKaAJTXzaueDfspuwAUg a1a5kZYrsuft659lsOI0dlJj0SvUy1cYkerUTu4GYDIGDXMI/TvutRQMRfV1Niv0Nhmr DkivTZbXkX3Ha768bunesXoCd7d2NyPsrtciZhzdFkfxmR0p8oTaYa3yNwXX8cDfTl2N ROawFrWLyTi3O8c7q8tZxzAzTL4P1cc4HPrN/LtEtmJZh0//ACSZ5e4tGpuigFO+GfnH Z5gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=ihDYOuRur+AmW3K4z8kSKJBQcwujO4SJmtgNkP0A9uM=; b=vVl+rSQZdkzh+aMwL+t8QbuA49QjUWb3/RFvgBTykIGupZHz+vEaU0O97BTTrZ13EZ 4GktKw+oR0OAOGQDwWEhNLO+4lEK8gOQ50xwF3Imcp2YkHBte/IhARVxbiTdFCXuf5vW B3LoH+bvYjlyQ47N4HF+kn8V8rtw4KKe8ce83jdqxrwd29UUDNaFiWUNLbd+ZZnFoYwR cUDVtCOytobJRHwYrl2MpLMdw9yzkuTA/9Xv1Svr/BX2j/T+NhCOkKU0B9Tbeh9v3dYa CD7TfVbu5WsT3u+aYZIZQ20Hon/cOGZPg2IrBISgRMiqC2qMKe0lliar+jNNNklcNAW2 2cjg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q9-v6si27447950pgi.162.2018.10.31.07.03.40; Wed, 31 Oct 2018 07:04:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729456AbeJaXAq (ORCPT + 99 others); Wed, 31 Oct 2018 19:00:46 -0400 Received: from mail.bootlin.com ([62.4.15.54]:34188 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728849AbeJaXAq (ORCPT ); Wed, 31 Oct 2018 19:00:46 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 12DAE207D4; Wed, 31 Oct 2018 15:02:35 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon (aaubervilliers-681-1-12-210.w90-88.abo.wanadoo.fr [90.88.133.210]) by mail.bootlin.com (Postfix) with ESMTPSA id D2A9C20756; Wed, 31 Oct 2018 15:02:24 +0100 (CET) Date: Wed, 31 Oct 2018 15:02:25 +0100 From: Boris Brezillon To: Huijin Park Cc: Marek Vasut , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, bbanghj.park@gmail.com Subject: Re: [PATCH] mtd: change len type from signed to unsigned type Message-ID: <20181031150225.175ec1d4@bbrezillon> In-Reply-To: <1535013819-1646-1-git-send-email-huijin.park@samsung.com> References: <1535013819-1646-1-git-send-email-huijin.park@samsung.com> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Huijin, On Thu, 23 Aug 2018 04:43:39 -0400 Huijin Park wrote: > From: "huijin.park" > > assign of a signed value which has type 'int' to a variable of > a bigger unsigned integer type 'uint64_t'. Why are you mentioning u64? AFAICT, the len passed to erase_write() is always an unsigned int. > this is ok most of the time, but can lead to unexpectedly large > resulting value if the original signed value is negative. > in addtion, the callers of the erase_write() pass the len parameter ^In addition, > as unsigned type. > > Signed-off-by: huijin.park > --- > drivers/mtd/mtdblock.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/mtd/mtdblock.c b/drivers/mtd/mtdblock.c > index a5b1933..b2d5ed1 100644 > --- a/drivers/mtd/mtdblock.c > +++ b/drivers/mtd/mtdblock.c > @@ -56,7 +56,7 @@ struct mtdblk_dev { > */ > > static int erase_write (struct mtd_info *mtd, unsigned long pos, > - int len, const char *buf) > + unsigned int len, const char *buf) The diff looks good, but the commit message is not clear at all. Can you reword it? Thanks, Boris > { > struct erase_info erase; > size_t retlen;