From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.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 D6D9130F92D for ; Sat, 31 Jan 2026 15:55:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769874930; cv=none; b=Wz3Uh3SwAuOh2JSmbrAMKrWw60vOkx7I72Ih9G9fWioIQwz60IOMyyClkGYleQb5Y5pvmZ269yO2NFlGUVXKkVdn9vmFVIERXEBQ3QosY4nl7CTYRoN68j7OUntSkWRVFI+gxUzLfjmtxSreum1+Nffp9Ah1WWS8PjqYCKMOG1U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769874930; c=relaxed/simple; bh=ZWej01u1Hf3SzaB0iOrbBcMuPcKg9g5dTe8m5aCWtDw=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Ulgl71wg+5wYwy9ZwaxqEbhgqxOTJZX2wXO2hdrQzLYci2OTwF2P2umf17S/xRzesjDf7nup5q1+ERe1gWn30RM51H8SIZAgN/SbS45bJkWCUpBPZ6sGcKQjcP90nV6EoyefU6iHZ83QMX2fpIKDRR7tDT/mMw0HKfVfZcGF2Qk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZGRYBSr+; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZGRYBSr+" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-48039fdc8aeso18156575e9.3 for ; Sat, 31 Jan 2026 07:55:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769874927; x=1770479727; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=6420eqZnmN5qhlr+s4u4L6GkZFEZpB8lEtq4Lv7b8uI=; b=ZGRYBSr+s/C1jFOSSHnFL+qE189p/9jOEUfmcUeFZQ9B/l3i3SQif+F2+HV9vR2SnQ nYCFRFVTAC9lF20cfk8JQkhNCSeLaAem1O+YWuHq/kgDvS6ts1FHtqBYwxesTFzOfRe8 qLV8URfbsI/jA9c/ZG2SOpLw+X2InUyM0ggaeYmFX/l32bzvoCjDEUkMD84cdiT9eEB8 uD7cZcAFZeo5tRSZlijejbPkrN8WpE1z8KRlpKwmkz2AAVRHFVq/v6wmp/2zKhMcndjR mFJsJioHMVLJBe8eTIApGzxiSJQC2cn88ufXwEdfGCP+rQVhvPAE6O67/O5uj7cNMjsf 9P1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769874927; x=1770479727; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=6420eqZnmN5qhlr+s4u4L6GkZFEZpB8lEtq4Lv7b8uI=; b=cQsvjuNgrPMlJ0bXl9LnyYXXSvcaRMWWfhYo9qv9EcftOm7gNGBnbYjKzoHmBQaTMO JQDcNLMDWq8CGR9QLsjTN43e+KuqaFc7sKzcv1KHrjE9Fn86zFpevpj/4eDYGU27SKHH TPz5uD99UsyTAEiPZoLshlHEWzfx30cse5Hh8BW0WDI/nhAByBkA7qsaS156L7S5NoP9 9lzP2MKJY7ykATUXiF2fDdFPoBZuYyyt/YieMqekANo+mz3H9HCnu3IyWR2E2rkIuT9D evv1B7dTCTvCIij0k+ArQQdf7cxG5Cq78tep9PLnklNQKLtIY4ZvPLQwebz9F0kWRhdg /DYw== X-Forwarded-Encrypted: i=1; AJvYcCUxUfhg039xa44JoQG/RpS7D0Qb1CiqsuNwB/qv7xEJYhUISyDJVBcx6syJ0OTp8+P38dzNggzVqOHUvEU=@vger.kernel.org X-Gm-Message-State: AOJu0YxCY7P58DUS1QHC9g1q4sp84ncXn7+Ex7Rc4Lv1KzdYwmq3CZHv VIUfVgvkk/b7SbC0/o+q0aK1FaJ0tpUXglGO7AxrsSi4zMKewIaUrUqm X-Gm-Gg: AZuq6aICyq+ySIyH9H5oEfSJHO+JCHDAyLIH/E5xTFVl0co5Rt7aNrAi6ZcWRZvpcqq GA0WCGVaKWZlhyhSwlOon6fDVZOL1ngrlwF4Bh9cpxONpaOv4R47eND9qmBfKaDPyDkOrjMW5S1 nyPY2xf2UPjoeMrUKUNNX12aQWkraz6kOi7LyAgfZJeXiJD/lkZRZJDfgdVz4Cxysqb7dYbVBpE 9ctAYo77QYZR2XBQxiAY9cdZvoae5knRe0WFms6Atkq6SBM1e7s/l1UwoBcRcPk2nZWRBmqweBG 2rUUYBBMLAoCKFApDn+ZlR6suj8H+TOhQU+rMw1IVermFUDUqX9SlNIUBXPS5qxh1Yw/+BxKMkb rI78b9tV9Cz/RiZ3DtXKFh0jbRKOeGza4fu7FV2RtxDl+Foh8xLSEjsGBmph4LgnZVcuCe0hkT9 K0rWfgeBbQlrrEsvg9N5UMt+UBfyt1dUVVvH20211mnDyodu7Sj3Qe X-Received: by 2002:a05:600c:4590:b0:477:9a28:b0a4 with SMTP id 5b1f17b1804b1-482db014bddmr84144735e9.0.1769874927157; Sat, 31 Jan 2026 07:55:27 -0800 (PST) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48066bee687sm502294255e9.5.2026.01.31.07.55.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Jan 2026 07:55:26 -0800 (PST) Date: Sat, 31 Jan 2026 15:55:25 +0000 From: David Laight To: Dan Carpenter Cc: William Hansen-Baird , gregkh@linuxfoundation.org, straube.linux@gmail.com, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] staging: rtl8723bs: replace ternary comparison with min_t() Message-ID: <20260131155525.05e1645e@pumpkin> In-Reply-To: References: <20260131133146.8174-1-william.hansen.baird@gmail.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sat, 31 Jan 2026 17:43:10 +0300 Dan Carpenter wrote: > On Sat, Jan 31, 2026 at 08:31:46AM -0500, William Hansen-Baird wrote: > > Replace ternary comparison for setting copy_len with the min_t() function > > from linux/minmax.h. > > Change is purely cosmetic, however makes the line > > easier to read without having to reason about logic. > > > > --- > > v2: > > Drop unrelated style changes and fix style issues by running checkpatch. > > Keep min_t() to make the signedness of the comparison explicit. > > (copy_len is an integer, wpa_ie_len is an integer but sizeof yields > > size_t) > > > > This stuff is supposed to got after the --- cut off line. > > > Signed-off-by: William Hansen-Baird > > --- > ^^^ > > > drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c > > index 8e41eb61448f..d36f6c3bc9b4 100644 > > --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c > > +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c > > @@ -4,6 +4,7 @@ > > * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved. > > * > > ******************************************************************************/ > > +#include > > #include > > #include > > #include > > These are supposed to go in alphabetical order, kind of. I'd always put system/global headers first, but that doesn't seem to be the standard here. > > > @@ -1024,7 +1025,7 @@ static unsigned short rtw_parse_assoc_security_ies(struct adapter *padapter, > > pstat->flags |= WLAN_STA_WPS; > > copy_len = 0; > > } else { > > - copy_len = ((wpa_ie_len+2) > sizeof(pstat->wpa_ie)) ? (sizeof(pstat->wpa_ie)):(wpa_ie_len+2); > > + copy_len = min_t(int, sizeof(pstat->wpa_ie), wpa_ie_len + 2); > > Use umin(). "int" is wrong because we don't want negative values > stored in copy_len. And the correct way to fix min() bleating is to change the type of the variables. Using min_t() ought to be frowned up and only used as a last resort. In this case I think all the variables declared with wpa_ie_len can/should be unsigned int. David > > regards, > dan carpenter > >