Received: by 2002:ab2:2441:0:b0:1f3:1f8c:d0c6 with SMTP id k1csp54336lqe; Wed, 3 Apr 2024 22:07:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXAmHcqE5IkTE2s1aoKFx5j77NO1ru3qPbpqCzy1+9b8ZlBWfW+aqMW4HDggS5NYnw6n+n5JukG27gIyTiKuOKJYl9HEKrEfad4vdFgyw== X-Google-Smtp-Source: AGHT+IHH0qIaSjxthywDBIw1TpObAjJE1T4V3zWqdXU5Sg9khbl5BMT53CCdPnFq3Hg9Z4jufkqo X-Received: by 2002:a05:6214:2405:b0:699:29db:8f5 with SMTP id fv5-20020a056214240500b0069929db08f5mr1766338qvb.42.1712207233937; Wed, 03 Apr 2024 22:07:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712207233; cv=pass; d=google.com; s=arc-20160816; b=YAmzdrYK9j/Tp+gHNUH44iKhTp2UNgt7o6g+9UH25QEe1T01biFIRI+VPfmzdjBnyP 9IP8lxKNUwOLkJhEjeCZM2sBMyi3YaATpJ/hwnaIVugeS7+dkOoUV3UQg1toxpTUsTra dqOiGrB8akVphmcQ1Jhio1QMJ/L87kvujZ4oaUpx3244oKi8PwnQ19NWvV/Sdajru9UG 2m5Adst73eOFzL8YD700KtierVpIqxGHSj1QMDQLzrlLkNOztX9iEdRweH1hFFIcbxnj sIVefpuNPJPoOKACkFPPyDM14IQ995bGanicfctVAMJsZsyWSE1oJEFQNSKN4lhR6vY/ kodQ== 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=Me4Obssr66zaQg2v15sp2gTtTxv/0MU8O5zS07cD7rI=; fh=bJ9/1tGDtXKH1Ma6utNxeqNnDp09U/8FDI5JARw8rUY=; b=TxNFyjGGfRLqW17wIg089RtDx5+4wwJLNtSZZZh67hK9WGjH3n6Rp3RM0jdmD9+oWj GOoHpMcJ7tjlCBsRXNW5qNj7TIV1dN+4mXddbelj62PzYDN3Xjnz5YQk1ZNYE/BbLbU3 q1YTnpDWp9oUUMkU4ZJonOQAqld4omkvhN+7LzsPE8Vhm5OJnpntBTDL/hbQfCXodLZk BAWKk4vH6/rwGSpNSBAmFFMC7DVA6zMlgW3fZCwmK/za4U3hKu76qtTUl6TdVwzG6wbL rkIJwWnjR9dQXMA7VXxDd18DXaOyUzp57+HcPRV4AKAf8HYEF8G0upBpS+4FUR/L2ByS q7oA==; 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-130892-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130892-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. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id c7-20020a0ceb47000000b0069906850c72si8716665qvq.321.2024.04.03.22.07.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 22:07:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-130892-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-130892-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130892-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 744621C267DC for ; Thu, 4 Apr 2024 05:06:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 874AC40BE6; Thu, 4 Apr 2024 05:05:40 +0000 (UTC) Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (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 36BD9405F9 for ; Thu, 4 Apr 2024 05:05:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712207139; cv=none; b=Y/Tfk7tjP2Dq/fXLm5xL9v9YBk2FG140sktth/dEXdFnml4firhiq7m2oO6oCs94TZ2LFEIQpgUIsE6/tWmfElKc7RNbUloMLs++BOwb9wnTTHG3qk2fC77zk8EqEG0NhnC/xdVHcSXmYaMELy5UvRU/EPuTxcGtZgYawpDtkV4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712207139; c=relaxed/simple; bh=abMEw0FTxYw4OfCoClmRJi0T46YZjCXPIzl8Pt6mUCE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=HjTtwvErW/ZlHcet+rNPi57m7bQgeg379ZR3TPlS+gED9wk73y+0hdE11rDRPoKeGDPkr2GtoRhp0lB9Q3oaR5KXh/wwGw/pX+AFcApq49NCYWbESEO9tXRe3cx0lGlKsFE//DuvxfO3XmKaQjSrYDq/DqQb4y2qfcVH84mOook= 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.128.48 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-wm1-f48.google.com with SMTP id 5b1f17b1804b1-4162a6a1f84so2697565e9.1 for ; Wed, 03 Apr 2024 22:05:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712207136; x=1712811936; 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=Me4Obssr66zaQg2v15sp2gTtTxv/0MU8O5zS07cD7rI=; b=Kp1XIW+wMo6x5kU432zGjSi0s6YwG15CJ8i/ojq8bYUiVjnKr8KzHzEiMUReOX1jHj mwWFtjiYXmBH/r7HpuH0vOMuFE4eokHpVNRJT8X6xikEmRVhiIMyQWMkYQd7YNVgviHL c8ty8cGLc9rlzMlJgrHBkrLaY4JiK8y7xJIpeoQ53pExfn55JhxMMm5i1R4s0L3HY1qx fNSGcXc1FBVTcdmK6dkAVFR99eAq7TtD2z41xPiZS8grHk2wSUbhs3T1q1sZrP2M7aif CNbIzI1pb53Zn0uIjgIqiGJKwfUJPA04eiaBbF8HB0CLIABXRLXzsE0y9aG3bV1cSMv0 bVfg== X-Forwarded-Encrypted: i=1; AJvYcCWUw5k2WgMUqEbQd1lwauyGxLg9reiQTmB3ou0T3Rq7ZsQJvF/kaOsxCt2d95pVh9FEpPAN5yPioyMaHgK3MgQhCiUBcKGTMcOiearu X-Gm-Message-State: AOJu0YyKATMzGiF0wdc5hUjLn9hsOIA4/Gg5rNQGXWXRzmmOHsnz3BC7 lVZjyKr+TjpyFRsYw5XQopFgY8iQWS3Cfid9XpLfXTRnUkXWCtLn X-Received: by 2002:a05:600c:1f8e:b0:415:6cf3:ef17 with SMTP id je14-20020a05600c1f8e00b004156cf3ef17mr1106448wmb.39.1712207136230; Wed, 03 Apr 2024 22:05:36 -0700 (PDT) Received: from ?IPV6:2a0b:e7c0:0:107::aaaa:69? ([2a0b:e7c0:0:107::aaaa:69]) by smtp.gmail.com with ESMTPSA id k41-20020a05600c1ca900b004156c501e24sm1226543wms.12.2024.04.03.22.05.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 03 Apr 2024 22:05:35 -0700 (PDT) Message-ID: Date: Thu, 4 Apr 2024 07:05:34 +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] tty: xtensa/iss: Use umin() to fix Coccinelle warning To: Thorsten Blum , Chris Zankel , Max Filippov Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org References: <20240403234729.175168-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+NZmuwgzHBcan8WC7xsPXPaiZS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CJJ9YtlNOPWhbKPlrQ8+AY52Aagi9WNhe6XfJdh5g6ptiOILm330mkR4g W6nEgZVyIyTq3ekOuruftWL99qpP5zi+eNrMmLRQx9iecDNgFr342R9bTDlb1TLuRb+/tJ98 f/bIWIr0cqQmqQ33FgRhrG1+Xml6UXyJ2jExmlO8JljuOGeXYh6ZkIEyzqzffzBLXZCujlYQ DFXpyMNVJ2ZwPmX2mWEoYuaBU0JN7wM+/zWgOf2zRwhEuD3A2cO2PxoiIfyUEfB9SSmffaK/ S4xXoB6wvGENZ85Hg37C7WDNdaAt6Xh2uQIly5grkgvWppkNy4ZHxE+jeNsU7tg= In-Reply-To: <20240403234729.175168-2-thorsten.blum@toblux.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 04. 04. 24, 1:47, Thorsten Blum wrote: > Use unsigned size_t to improve len data type and umin() to fix the > following Coccinelle/coccicheck warning reported by minmax.cocci: > > WARNING opportunity for min() > > Signed-off-by: Thorsten Blum > --- > 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..b493fc50933d 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, umin(count, len)); The cast to unsigned (ie. umin()) is now not necessary. You should have used min() as was suggested, right? > } > } > thanks, -- js suse labs