From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (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 99D5B2EAB71 for ; Sat, 31 Jan 2026 17:36:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769880962; cv=none; b=q8a9e+rMxgWlYQfavWboXq/Y1tN5U4t/RpBqa+CJcKH7BH8Cee4GRc6lXI8MuSmPqv/as7lLS0CW/LHk75ce0R4fDi64+qqZK+6TKoYoOI4UOBFugxrIl+huyO7hDRSTVr52C5o0lDLVQ+B873/dGyHUnCpWg0DFf4+t2UL+ZPE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769880962; c=relaxed/simple; bh=wRYovOCJEFYpD/m0OWEX50lFZV6t2ElXhxxMy4k9Y9c=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=l/8elYZg8Uz8I8UyRIuxAvzxEEmc2/GxzBKIHH43VHHpX0DOEU6sEVSThu+DtcAQFyyjgmWXTomG1JoLWfwi+rq8hYNka0rB05h8r9BftPaUJF+QaqgsRdaBuygqD4qsuvxmlVuTmjK75Uie4fmw5t8y7Zsct1u0VNB/zD95Wro= 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=wTz2lRA2; arc=none smtp.client-ip=209.85.128.43 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="wTz2lRA2" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-4801bc32725so23087325e9.0 for ; Sat, 31 Jan 2026 09:36:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1769880959; x=1770485759; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=DJGtibyHN9DsQJLWN5q9bgxgdkmcmPzmFO5lZgA2ACE=; b=wTz2lRA2Zu8KcqfgkMiQn8iA99c+0jpaT8z6qakNccx0CO56BZcX2aC7lLbNvVSPoc TTzS6QGFig7LuJzJ5gG4q4DLi2FrqM4oi7LqhDbrV+pOxh3UNUIGdysG05JMwhMV61C2 ckskXD4u+Ej0vp/tUUntvUpfbLUxzMXCvk04QjJKl9IIboutVz6XqPnVC2EuQ9lywHi0 YRz8QskMiNHFT2fLjxfAKBq6WppgDDOqRbgbX4facIzOKBfkF7VUK+eWwP2E7jfsFo7Q MOhj8LXczNyLrbRekr7xnq1WhYSBl2kuDm2qCqPT7MTrihFRKWgecaXIBE0lgp+7uiCU fW6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769880959; x=1770485759; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DJGtibyHN9DsQJLWN5q9bgxgdkmcmPzmFO5lZgA2ACE=; b=Erp9QfF1JcLYPIqJqcde6rHHUgMAVtQPckdbR2AKdmIW3TN7ukSaeOq8TN5QvjszQp 8zU4Saa66QFMc512ty17IWUZ/bHmLvYA1zWz0bsANytQJVx2RXqs19amUIY4ZmmzYXwT Fy20vRG6fT16EmSpeWxq+iTVxxXr84dk3fBeHoKjvvpKn3zaDgq+9bFDJdgfVgUZbH65 Bu6CaE7jUCZiKpai4jGkd9R2ab2QxlkSHY2CoORSXbsD6Qlt8iolX4DmNtXx7IRhSNda XpK5Ri9abe4HYJfTYuSWehh0SEeGQlZwIxJPUaVujU7s50P4Jy7d5cZjKaE31kobNUDP 9rdg== X-Forwarded-Encrypted: i=1; AJvYcCWU4iPxZyxuNowJvwJrjnf4k7xRJo7e7MQHpJAhoIp8EVFo8tXtDTim9nMBj1v46UjTGhu90yAM2guHSZ4=@vger.kernel.org X-Gm-Message-State: AOJu0YwLBGNvQ32fCzjPK1AIa2yMrkzCIakbf6RGU2wQMFAEtl3QziT8 kUWdnvk/OTRdEnmNNttjMdREfhjLPEA9b4FQt2DtFOQUtrpJrzerpWkzlWxMrxA2eUc= X-Gm-Gg: AZuq6aKbPCHN+j4fwgVKin7HHtPllRwR7FelLU5y+2bh1/bydi5/gJ7L7kXdGgSuyXP b2g5yqrGW3mIS5ZpZfVRMVFzqomJwsCCXx4T78iCrA98AgoTnnr68hrvekeISv9gx/wDkNuT2qd czo7V6/FdQhcOfpEpw07Yg6GHD4jes8xz1TPfdM5UcrydIKl/kPzhudQR/6+T4vX0dpPHb1Q5Am xJT+i9YFNVDRzeo8LNIsVoBTyNJEjUO7LMYQFi/Mo7Da3yUmNIi8cbC0sABbbfj8hUEzTCvKPti MHwNEqmSV3Bg+aLIF/L3DjWjliz1Mhq94wUokVqLB6RFPfhctmqugVgl+UgXPj+dSHYyBg/5CTw uJ68opcEbwGml8nRSM3rSoEpGi53QXlP4xOoTd1Txhm2WexrBm+8x5a9wwbvXigt3/WiS/Ll+XM 2rXYykw+ZDCASELl6+ X-Received: by 2002:a05:600c:1d03:b0:477:63a4:88fe with SMTP id 5b1f17b1804b1-482db4521e1mr88434325e9.2.1769880958855; Sat, 31 Jan 2026 09:35:58 -0800 (PST) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435e10e4762sm29526106f8f.6.2026.01.31.09.35.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Jan 2026 09:35:58 -0800 (PST) Date: Sat, 31 Jan 2026 20:35:55 +0300 From: Dan Carpenter To: David Laight 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: References: <20260131133146.8174-1-william.hansen.baird@gmail.com> <20260131155525.05e1645e@pumpkin> 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-Disposition: inline In-Reply-To: <20260131155525.05e1645e@pumpkin> On Sat, Jan 31, 2026 at 03:55:25PM +0000, David Laight wrote: > > > @@ -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. > That also works. regards, dan carpenter