Received: by 2002:ab2:2441:0:b0:1f3:1f8c:d0c6 with SMTP id k1csp107985lqe; Thu, 4 Apr 2024 00:41:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVp0clyUbAoyzyeZihAoa3/AxQyFNku4StHf9XIv/llyfgXgFpo6keFhOZ8LjB2+0n1Xi1pegbnZiAQjfwZP3Q50XxS5ym396NTKKP4jg== X-Google-Smtp-Source: AGHT+IFejEYbKp35CDy860Sw09gE95xtGXa1awOnA+/EP5n9pQwvzbBXR9nUZkvMIiScALoLzb46 X-Received: by 2002:a67:e219:0:b0:476:d846:d00c with SMTP id g25-20020a67e219000000b00476d846d00cmr1661745vsa.15.1712216508320; Thu, 04 Apr 2024 00:41:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712216508; cv=pass; d=google.com; s=arc-20160816; b=qSfGlV7UbByzKBpy54p3i80KxBfRrNEd9DqQ6qXU+YNm/3jfEWT1lmjAox+oTwwcv7 dMgAdrixz4gp8wRDE58J2XUcu+QNCzC1kqnESIkdqhZiJfdpzG98MuYtSne9jPGLyjxT 7GtXQjk+NeavxDgxkpLgcdadnsUlzA6Fn94n41flYIS8pRjcdbAZOoNx/yHCJiv7Ugg3 JPKEgiR9ZFoV16mFI3z+61nw+X+mzuMhdQ4zDLlnFqKdSr2TSCSpbEiYmmdQWTI3716Q gf8l+5fq8gTD9x17daliK+xDxSUy2EROxVqSyv7fUWQmoj97ImE+PUM4gX3HMPMTP+yC hHDg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id; bh=4YTmrklZRV6jW/HZ0TsvAHosNpfgWBD5hKPM6rhkzbM=; fh=UzhNAqZPra4THDqz8+0Sw8K6afpXFKD6XQ/pbP8GYLI=; b=wAUadMjbS1HjHjMW2NtO/pqq0zmsaP2xniITogXXuiM9kFbcTFgVF+ZipNVp/DnS+t VhI9mSuceGXOAmYurNTrmhBKvDowXlWtYrm6Uoa91lp8aUwHY8t2AwAQCacsH7RJfc5H Mgiwde8QOFj9YV1vdJplvVokFPZ1buOvAmCTNnyeH4lyukeK9Aij9ZHYqayrpyauhJEh 1JoUG6QTp2oeZs9PFBSfMwssDdCcyJT/rhXBfP51YETUV3fUmUXBV7vBQN8CSgQBwXx2 PH7iLA1iSpCtNzWNoYGnvCTQfM4QcOgQFfKrPV3Yof/C4wl2UjaCgkbbQtOQJvLKfrzE LAlQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-131044-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131044-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id l15-20020a056214028f00b006992fb187b5si1471132qvv.394.2024.04.04.00.41.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 00:41:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-131044-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-131044-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131044-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id ED58E1C22621 for ; Thu, 4 Apr 2024 07:41:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9D1875B208; Thu, 4 Apr 2024 07:41:42 +0000 (UTC) Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (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 639411CFBD for ; Thu, 4 Apr 2024 07:41:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712216502; cv=none; b=Om99IyK7fynHg+8jzu1BXi7HeQcMHgQTEgkcp3dV6WmkNZWTVBTKzP/OGRvTG1+hogJbAIugR6bnlSE5xpcTTb2uFs6kcJ8niZS2Zvl8K6T5DtEAeNsCidSP5YU5JxFdC7ut05jiqrRBVQQntGM904mVE0AoTithkcI5yMpcDhU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712216502; c=relaxed/simple; bh=Ior+dp/Myvyx8DDqC8/TDNbfggvtW4FD5QOKYwJ4qsE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=H+qP44Ok4Eh/TvmuGbLQoG/Nsq3/4PWWPxO5XBnnc3MCAU8ZcArZDJDKEreXg5n7+0LwDwnqfolTsyb3BKMYr6VvcsGHqRKiujEq1QZQE53BawnyL+DUGxUl5sAyTlEJ/lP1A4KsaPhnjIUDiz8dtEEZUmXtvkTWLoSEzF6UVqg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.221.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-3437efea211so592502f8f.2 for ; Thu, 04 Apr 2024 00:41:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712216499; x=1712821299; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=4YTmrklZRV6jW/HZ0TsvAHosNpfgWBD5hKPM6rhkzbM=; b=poUBjLTDXY+nuVaIQj0xwKqnNHEWjEP4cRf+RcwoJHvKipob2iTXAiagzRLDZAKaio nLr8ZcH8NrAXX1qnZK2W7pJ3Pj7Wmgrqp/u1oorVj/CXR8Cn/jTOgJhegFIS4HISS3MG I1HFmYFhfaTxuUOA7ZWntOnTptNBUXF5779uDG2GRJ41jPh9rFXtee45x/EDi0HkOaeg ww8aqknp7jS0N5EMzLOxp238pKqRg3cckQSB1CadvBmQh9mJlJsvnghjarRIOFQmx+qn 20rnTO4vUV6w9sEiMfmsWJ9EjfdyiZhHAtkcjxbHoAMEsuvMVNo5dBt8y/TGnMZ3JLhg KZXw== X-Forwarded-Encrypted: i=1; AJvYcCX+6D3+doOY6JUmhISA2o5gV8p0Fv4Ss2E2LkHw/aZ2lXt55Jt5pP6wA0YjHWGjunV7aQXRP9iJznSfJqAIFbNmpb/J59hrdx9reAZQ X-Gm-Message-State: AOJu0Yw2d1BKDmBwH/pgNbzMXFq32jQk0r3m+DAwUbfkS6MnuS9x/kXI /IW4LxR9NzSQdYPcBJaO1WnXmvSG3p3B1AuuiNzpFH2Crvwuk7mt X-Received: by 2002:a5d:6283:0:b0:33e:dbc0:773 with SMTP id k3-20020a5d6283000000b0033edbc00773mr1494228wru.44.1712216498574; Thu, 04 Apr 2024 00:41:38 -0700 (PDT) Received: from ?IPV6:2a0b:e7c0:0:107::aaaa:69? ([2a0b:e7c0:0:107::aaaa:69]) by smtp.gmail.com with ESMTPSA id ay26-20020a5d6f1a000000b0034355b7e995sm8350225wrb.13.2024.04.04.00.41.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 04 Apr 2024 00:41:37 -0700 (PDT) Message-ID: <528c6824-287e-4be2-82f3-7fcdd254eb15@kernel.org> Date: Thu, 4 Apr 2024 09:41:37 +0200 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 v2] tty: xtensa/iss: Use min() to fix Coccinelle warning To: Thorsten Blum Cc: chris@zankel.net, gregkh@linuxfoundation.org, jcmvbkbc@gmail.com, linux-kernel@vger.kernel.org References: <20240404073801.5716-2-thorsten.blum@toblux.com> Content-Language: en-US From: Jiri Slaby Autocrypt: addr=jirislaby@kernel.org; keydata= xsFNBE6S54YBEACzzjLwDUbU5elY4GTg/NdotjA0jyyJtYI86wdKraekbNE0bC4zV+ryvH4j rrcDwGs6tFVrAHvdHeIdI07s1iIx5R/ndcHwt4fvI8CL5PzPmn5J+h0WERR5rFprRh6axhOk rSD5CwQl19fm4AJCS6A9GJtOoiLpWn2/IbogPc71jQVrupZYYx51rAaHZ0D2KYK/uhfc6neJ i0WqPlbtIlIrpvWxckucNu6ZwXjFY0f3qIRg3Vqh5QxPkojGsq9tXVFVLEkSVz6FoqCHrUTx wr+aw6qqQVgvT/McQtsI0S66uIkQjzPUrgAEtWUv76rM4ekqL9stHyvTGw0Fjsualwb0Gwdx ReTZzMgheAyoy/umIOKrSEpWouVoBt5FFSZUyjuDdlPPYyPav+hpI6ggmCTld3u2hyiHji2H cDpcLM2LMhlHBipu80s9anNeZhCANDhbC5E+NZmuwgzHBcan8W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giBzbVx8G+fCJJ9YtlNOPWhbKPlrQ8+AY52Aagi9WNhe6XfJdh5g6ptiOILm330mkR4g W6nEgZVyIyTq3ekOuruftWL99qpP5zi+eNrMmLRQx9iecDNgFr342R9bTDlb1TLuRb+/tJ98 f/bIWIr0cqQmqQ33FgRhrG1+Xml6UXyJ2jExmlO8JljuOGeXYh6ZkIEyzqzffzBLXZCujlYQ DFXpyMNVJ2ZwPmX2mWEoYuaBU0JN7wM+/zWgOf2zRwhEuD3A2cO2PxoiIfyUEfB9SSmffaK/ S4xXoB6wvGENZ85Hg37C7WDNdaAt6Xh2uQIly5grkgvWppkNy4ZHxE+jeNsU7tg= In-Reply-To: <20240404073801.5716-2-thorsten.blum@toblux.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 04. 04. 24, 9:38, Thorsten Blum wrote: > Use unsigned size_t to improve len data type and min() to fix the > following Coccinelle/coccicheck warning reported by minmax.cocci: > > WARNING opportunity for min() > > Signed-off-by: Thorsten Blum > --- > Changes in v2: > - Use min() instead of umin() as suggested by Jiri Slaby > --- > arch/xtensa/platforms/iss/console.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c > index 8896e691c051..d2380767f3a4 100644 > --- a/arch/xtensa/platforms/iss/console.c > +++ b/arch/xtensa/platforms/iss/console.c > @@ -167,8 +167,9 @@ late_initcall(rs_init); > static void iss_console_write(struct console *co, const char *s, unsigned count) > { > if (s && *s != 0) { > - int len = strlen(s); > - simc_write(1, s, count < len ? count : len); > + size_t len = strlen(s); > + > + simc_write(1, s, min(count, len)); So do you need 'len' after all :)? if (s && *s != 0) simc_write(1, s, min(count, strlen(s))); sounds good. > } > } > -- js suse labs