Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1708613lqg; Mon, 4 Mar 2024 00:53:21 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUKf0Ha6DIxGoPj5d88UePvDVQjq+MtLMoVJYdF3G50kq1Yo+TJ2cqcSnnBKzc+kHsNvf/gJ6m/r5a2IZDqizrOolNZw3U9ab4WrCd5JQ== X-Google-Smtp-Source: AGHT+IESwwQoZ6rn0za9LfheGqaNUjYqyuKK9tNMTmfA0+cWzyvqcfAGd8QE7hZjehwQWbbjFZKU X-Received: by 2002:a05:6a00:3cca:b0:6e5:9342:f0fb with SMTP id ln10-20020a056a003cca00b006e59342f0fbmr9676296pfb.14.1709542401219; Mon, 04 Mar 2024 00:53:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709542401; cv=pass; d=google.com; s=arc-20160816; b=yxxkAuDUNCfK5GCP8noPebnXhAyQiOwX+NvR+tHGNhqq09/N1+5htgZnD+dJxgoQTr uAtTnR+93brT1KOy3zW8nUIL39hQiSETKPFPBC5G2cmZ7YZjGSItrrOgYDTveo294nWl ujsqpU6SMSSUWHKbRTXbfbdCFe+3S3YyrNVhrluPciQQwykCMxrGzU6w0HlauixgHdbG ujRMBKxGEgHz8HZ5BwWmRBGvbpPxI0AAaiYLWf2n5iPoAWxWU8k0WKTmiXF18Yg2DrfW CXZG5SQkc7Qo9hAxdfbnPeayKwQfavxmoOWf6ZqKfAGO9YQoCF+sagnTvv36rJyyYLsA 5d6w== 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:to :content-language:subject:cc:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=4zepHEJdQE5Px4i8JPbZeGlyG0SagupCJZLu0W0l0GY=; fh=egbFislu+oILgCOjDZPtwsSPL0iAr+zhN0q2Dt/uZZw=; b=YLqotlWDVjZXeNr4ZdpOqooAeZMxq3aSVypOKRAdNf3vYefrxDEsbHPQaz5Vg5ALui bhLq6dgzc6arui5/w/aYYzq0hpuxHWpZz37cIWQt5EBkXJ0OfTamzd1Hjkbikg/YWPaI H4LZ8GdLRN3oI9b5oS0L2rllV1f0PQ9mBEUynQ2otZpykWKW/1fg7toGFfX2aiPKMIhq myy7kbOBm1x03K5GBgYX2Jg6EKT8DBUtEDDC2oTSVTheD04HEfoR+lREAHgvMXG7nuLN gasCkPQiyU0OZU1u4Asj0X5c6+G5WyM3+yy3LyAHhEJzxJ7JlRd+r+6EvyLvyh4VPT54 XeBw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=bbmqj9Cu; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-90244-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90244-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id h27-20020aa79f5b000000b006e5ad30334dsi6590951pfr.69.2024.03.04.00.53.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 00:53:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90244-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=@collabora.com header.s=mail header.b=bbmqj9Cu; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-90244-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90244-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com 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 E02EE281B74 for ; Mon, 4 Mar 2024 08:53:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 867B625756; Mon, 4 Mar 2024 08:46:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="bbmqj9Cu" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3DA9B19474; Mon, 4 Mar 2024 08:46:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709541972; cv=none; b=G5GaSYgNm6+FdPih0ohdJThgUmbygHGUoyPQMRrS3pxDX49CSl4XLkdxl/yG9dPonREHcfmdxIjZDDjUTt0p2EEtJYd7BN/R0lMgpA/m6M3cTI9wYiPup0S0hnCKDt8AU8ukwKuJqPE5Y0/sGiQL4NWkXCXdlxyTEXBTDcIScQE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709541972; c=relaxed/simple; bh=gkCW8KsdIC7ZfO49SVRDYAdSUC2Z8gW9XivfLoDvYPs=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=F1p1wQssnJajZIF4vKOwWwIf5n9fXAyLQE295nCh0jbmd6yx1vIgX6Tmya1QYY0DayzLrEr7a1pQcq0tTO9JynbGF+8N1opnCFJQmST0LMEyhVOhMKlQx66etxej0SK2W2WXZHl+XN0UBzwH6pFWVbnD+Td+maKN0+S+YMsWS0k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=bbmqj9Cu; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1709541968; bh=gkCW8KsdIC7ZfO49SVRDYAdSUC2Z8gW9XivfLoDvYPs=; h=Date:Cc:Subject:To:References:From:In-Reply-To:From; b=bbmqj9CuuzAWYhrZ5GlKYRmjhAFMpkAQSXihWxkuAw6Xt6xEjpWNGjS8alQ8AVNlb Sl89lqht6JSrxxUKbQ+FPcdZbySuTM/umAkmsLzkVd2CPrBWDTBGU3ldQdw671eIPX UbwhgLdluWM/7K9fHlmzY3wSmK5sH38TZFdfAJi8pl72U6hpDJDwdTNiB9UgHcCt/H RhnzD9omeD6JR7mBD+TrSxKZ5TNpnjUj8tV2uMZujmLRrL+F9UexbaBj4scHusIWbw qaCkIp8zMplisVsa0tA8fGrUqwUpJpB9dRtjJQUEImoG/1jdKa1gv/7RTslQzbhbOu v4GhYuV6mHkjA== Received: from [10.193.1.1] (broslavsky.collaboradmins.com [68.183.210.73]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: usama.anjum) by madrid.collaboradmins.com (Postfix) with ESMTPSA id E127B3781FE9; Mon, 4 Mar 2024 08:45:50 +0000 (UTC) Message-ID: Date: Mon, 4 Mar 2024 13:46:21 +0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: Muhammad Usama Anjum , kernel@collabora.com, kernel-janitors@vger.kernel.org, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mtd: spi-nor: core: correct type of i to be signed Content-Language: en-US To: Tudor Ambarus , Michael Walle , Pratyush Yadav , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Takahiro Kuwano References: <20240301144517.2811370-1-usama.anjum@collabora.com> <713393d5-13ef-4891-bf7c-d835edacef8a@linaro.org> From: Muhammad Usama Anjum In-Reply-To: <713393d5-13ef-4891-bf7c-d835edacef8a@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 3/4/24 12:51 PM, Tudor Ambarus wrote: > > > 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. I'm sending a v2 with int. > >> 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; >> > -- BR, Muhammad Usama Anjum