Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1685604lqg; Sun, 3 Mar 2024 23:51:40 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXqmS+JK0o0/BwR9M7AEpkTS8hwwHz7SIyd1ffmjSM35+bWIZdkNa9+elYgtLB68f/yUwEWzqQiOWjm7Au8RR9F6CmHmHLZz8PX3aC52w== X-Google-Smtp-Source: AGHT+IFRI3tXQpn6muYx7fpkOfJvwRQosluuAYnGfzlrIAtc+86BBOcGvahi12p6KV5xwKYqIHwh X-Received: by 2002:a05:6a20:da95:b0:1a0:8897:85f1 with SMTP id iy21-20020a056a20da9500b001a0889785f1mr10547343pzb.6.1709538700124; Sun, 03 Mar 2024 23:51:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709538700; cv=pass; d=google.com; s=arc-20160816; b=vCdZ0EFRDr+a7R1HRAH/O1HdFQyhkJQZwdSvXP+PHho3v0xgAQOxvQyfV7LGU9fMcU kX6aCllXCmfAsyjPjgt2ULMGDWqKnO+LGcyRapbcDfWKfuHgBHCV7mymCS6rTVOflK9O YiQ3/iV4AUw1QMcg512HRJc4Ey8ngMXvo9yuCA9n7k8Qg0YyCz8UAxeF49uSVirw2nHd 6X8EzoQXsX9XLt2nEQJ8X6kv2H2tLaIZZTGsp2xpC53wJLVQhapqq0BgUtq2wafXqXj5 L23qtP8kCZKiGM+9xjcz95MD+tgGBgr67kf0jl7MdBN/xDQ+9ad7AIZlafba6ztN5DfT gazw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=HWvU3Y40gzx94WbLTxYgWZzKcXstQArKnjMG7cs8mWk=; fh=d9Hy+os+sWDzrEoKTZ3UeJZErmQqBtEMNf5nVOIXnOw=; b=VBaSxxGiqUwCtbBsBWU8Pnf2r5Chk0y0HreFUu9AwEY52lgP5sJruHrpqmiLu07KDQ C1PtWXKs6dcQM9bVI5g0CiYaiHaTHl1mE38adcVDXmQweDA987XDyhQtmpN33JJ/hz4e i58TKHJr3RFX86zaOb6R340GiNycgeRSOfwM36RGeglIJFMiF65pgZ+GyYYXYD+Ufjlz 38vxTV7z2Z+1M5lDiVViySHb37lmIy+TUFer3l6j/Vtxlzab1U329LjjP19eO0pSVNS0 3o2DVNQIBy+Sx6z1e5G9dXJ6a+eLdLVibfezEDuvz0GgYY5VfJha35qEWC9elUYKCTN5 IP5w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WDTRsunw; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-90155-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90155-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id e9-20020a056a0000c900b006e50e7bb75fsi7823015pfj.0.2024.03.03.23.51.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Mar 2024 23:51:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90155-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WDTRsunw; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-90155-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90155-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 62B3E281620 for ; Mon, 4 Mar 2024 07:51:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 85ADA168D2; Mon, 4 Mar 2024 07:51:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="WDTRsunw" Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2642D16429 for ; Mon, 4 Mar 2024 07:51:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709538691; cv=none; b=ATYOFYW7lOOs6fBlUoisqej8JSO3bYUljH9azPC2Pa37Sj87J+tRnAcZHmmPFXX7nFZWn6hy79jk/aCQll4F/YSYw04V8lOs6iNgMkxaaNHMp0a3G7hPPTdSYfwzxnK1QPXtnG3eujjZVdYdTjRa+YwNaqzDODNfZVAxWuPvXwE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709538691; c=relaxed/simple; bh=owFBBvSyol5Quh62N2HJFLrQ+Rxow5j0Z9jnmALctYs=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=FTfCfTDuqmLbHsopss4KWavoat5Au0lljs/2y8tkRY7M+FOqPcEDmtAdBscadVIwAobnSo/J3XMQ+AujWqKqMiT8QlX/Kr31hOSVjd9wD7GzrY26PJ6QrDEaB30afFY4d+dzqGb55HJYaHGnJDBRMUn2ok26TfiYV5HseSLfnLY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=WDTRsunw; arc=none smtp.client-ip=209.85.167.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-5131316693cso5335726e87.0 for ; Sun, 03 Mar 2024 23:51:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709538688; x=1710143488; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=HWvU3Y40gzx94WbLTxYgWZzKcXstQArKnjMG7cs8mWk=; b=WDTRsunwPfgmt0sAk8E/8rZWvSTZzJ+/GFNiPjtRj660JluNWT+JElndh43EOv2YzJ 9kVNOKQMy+j2DYLmlHJzzps7uz7HD5yOOq84Ov8WsimQps5YoB8mWPvDrbrNVOOlq4i6 y918SR9DZtmJRqijMJwuqIMrdU4bVJDph4C9WajbA9U/UdARH1ZvMFyNnx5h5OE++gMe 3FfejdJP3gC1GIJLPNdiMsUi3uo42wPjdYuJVvQKwZLCpnG5SGjZyNTL4z9EnfOUlMdG Sm+AfdocmBbVLebljWTeNLlMZZYgDERhGyqpBCjyr/hc14ye/dk34mDp4ZZEKo8Ndb/H VzEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709538688; x=1710143488; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=HWvU3Y40gzx94WbLTxYgWZzKcXstQArKnjMG7cs8mWk=; b=Ro0VxxE1JAWiWLpGOajosVdOKjejjcFed2qKc1s1oD+ONplFdf9sc8m4UcX5T47wNO 2wu3NITUv+ucprmEkpUpo1EC/Ci6+K8AgMVwLs/WFzNUlWa95WaXj21myPsMIYPAPDDt A/kQBypvBb/36pYjm2ET5yBnk6xzCBKTThXs5opwg+1qWtHFwRGqP7GCkNp9Hjhwm3lb kvj2c5/2K1FuVK3kBTEadj4f2b78mlVuxdQGlvEA4vHEc/iW8gRu5kaM0JASupyj1Jir TCQJY8ZSJBjVUkPmjkjOVerM5Jy2mE255N16WntVlxX+bll8RcU+YWQOsBI/SUlfeSpO /LeQ== X-Forwarded-Encrypted: i=1; AJvYcCWAxTG7tNAIo8iiA3Xg8VieNgsjnZ4GZSydoBT0kwNyI3zSH5EfMGLuoi1y2xcPb2GGj6KH9WA7JeaX4zhGzjoXid+0S35KFu0CpYSM X-Gm-Message-State: AOJu0YzDwW33MRskR7J8gSmWuM/q40E70nvwS9vwWGWQZ70evKvDdfm8 rE28B3ApI/SaabBj/O66k8h3fqrmWUNkI7e4d8UrHwkCEe4cSgPYFhYr+SlpnEw= X-Received: by 2002:ac2:5e35:0:b0:513:2347:4b57 with SMTP id o21-20020ac25e35000000b0051323474b57mr4460752lfg.66.1709538688355; Sun, 03 Mar 2024 23:51:28 -0800 (PST) Received: from [192.168.2.107] ([79.115.63.35]) by smtp.gmail.com with ESMTPSA id g3-20020adfe403000000b0033af3a43e91sm11481037wrm.46.2024.03.03.23.51.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 03 Mar 2024 23:51:27 -0800 (PST) Message-ID: <713393d5-13ef-4891-bf7c-d835edacef8a@linaro.org> Date: Mon, 4 Mar 2024 07:51:26 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] mtd: spi-nor: core: correct type of i to be signed Content-Language: en-US To: Michael Walle , Muhammad Usama Anjum , Pratyush Yadav , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Takahiro Kuwano Cc: kernel@collabora.com, kernel-janitors@vger.kernel.org, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org References: <20240301144517.2811370-1-usama.anjum@collabora.com> From: Tudor Ambarus In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 3/1/24 15:04, Michael Walle wrote: > Hi, > > On Fri Mar 1, 2024 at 3:45 PM CET, Muhammad Usama Anjum wrote: >> The i should be signed to find out the end of the loop. Otherwise, >> i >= 0 is always true and loop becomes infinite. >> >> Fixes: 6a9eda34418f ("mtd: spi-nor: core: set mtd->eraseregions for non-uniform erase map") >> Signed-off-by: Muhammad Usama Anjum >> --- >> drivers/mtd/spi-nor/core.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c >> index 65b32ea59afc6..46bc45b80883f 100644 >> --- a/drivers/mtd/spi-nor/core.c >> +++ b/drivers/mtd/spi-nor/core.c >> @@ -3373,7 +3373,7 @@ static u32 >> spi_nor_get_region_erasesize(const struct spi_nor_erase_region *region, >> const struct spi_nor_erase_type *erase_type) >> { >> - u8 i; >> + s8 i; > > Can we just have an "int" here. So we don't shoot ourselves in the Muhammad, do you care to resubmit using int? Would be better indeed. > foot again. I'm really no friend of these kind of micro > optimizations, it should have been int in the first place IMHO. > > -michael > >> >> if (region->overlaid) >> return region->size; >