From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D26FE2BEC2E for ; Wed, 28 Jan 2026 18:02:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769623365; cv=none; b=LXhuPtkGyjg59SmeicGntZJpoI5XMIyCwOo3/L6dvWR1ZbCsyzC1LkJ6QBfYh1JkjlcvbZv7IPP42un1Jy6FqnC6UEE0nybtzw/SLgLEvHoh1S2+ZrPh8iHBKeNUCCh6PAKGMXhjT+59TeRoFmjjr73+0RQDb9rf7vpeiD/cpZQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769623365; c=relaxed/simple; bh=uzTz49XE1Hx2csddmUgMnlS4lyasEN/R0ed2DF1alq0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tmLvxXJC9RTkvTIy4yGNn9r/VwXzi1zJjlfaZb0rkYZ35WM5ufstVdOnMxqokOXZjFr1pE6O1mfaxo179sjBANwd5Xx+1AQzEpjD9VZzjKCLv6wLiKR1s8Ht7ydBILwdjJHmg7VM4VER5/9eu8U5UnX0zBFKHUyzlmmyqzJAF/4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sN7KUR8p; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sN7KUR8p" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4DD3C4CEF1; Wed, 28 Jan 2026 18:02:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1769623365; bh=uzTz49XE1Hx2csddmUgMnlS4lyasEN/R0ed2DF1alq0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sN7KUR8pdsOcVGAkw7UCqGas3wE6MtIeGDftXCSaRXoEsu2Vv4TxEvKpgVq/HbhJH Suvv3SL/ZJ9fOFpM/saSi1U/UUHaBjoEHhhapX8eBdhDAT7HdooPJ0Mua9yHsSaXgL /+7d2M9gXrslOHd8rfwqed2tkTCGmBsymi6BN2xWr1Yz6fZXKSChujz1APSt+7xCrf xRsGBwOHG942dvGa6ftDKO4shty8rEfPCplVAGuOBpgu/7BgLmzk3uyUJhUmYxi7X0 qk3/pgW8KS2ha1H96oC+Uurl0SGLROyw2lPVcB3gnsOwohiCnmCtnLMvDgJ5pP9MnM 52K4/K353GtCQ== From: Sasha Levin To: stable@vger.kernel.org Cc: Yang Guang , Zeal Robot , David Yang , Greg Kroah-Hartman , Sasha Levin Subject: [PATCH 5.15.y 1/2] w1: w1_therm: use swap() to make code cleaner Date: Wed, 28 Jan 2026 13:02:42 -0500 Message-ID: <20260128180243.2612857-1-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <2026012736-shaping-sixfold-2889@gregkh> References: <2026012736-shaping-sixfold-2889@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Yang Guang [ Upstream commit e233897b1f7a859092bd20b10bfd412013381a10 ] Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid opencoding it. Reported-by: Zeal Robot Signed-off-by: David Yang Signed-off-by: Yang Guang Link: https://lore.kernel.org/r/cb14f9e6e86cf8494ed2ddce6eec8ebd988908d9.1640077704.git.yang.guang5@zte.com.cn Signed-off-by: Greg Kroah-Hartman Stable-dep-of: 761fcf46a1bd ("w1: therm: Fix off-by-one buffer overflow in alarms_store") Signed-off-by: Sasha Levin --- drivers/w1/slaves/w1_therm.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c index 67d1cfbbb5f7f..b745070e8c4ae 100644 --- a/drivers/w1/slaves/w1_therm.c +++ b/drivers/w1/slaves/w1_therm.c @@ -1782,7 +1782,7 @@ static ssize_t alarms_store(struct device *device, u8 new_config_register[3]; /* array of data to be written */ int temp, ret; char *token = NULL; - s8 tl, th, tt; /* 1 byte per value + temp ring order */ + s8 tl, th; /* 1 byte per value + temp ring order */ char *p_args, *orig; p_args = orig = kmalloc(size, GFP_KERNEL); @@ -1833,9 +1833,8 @@ static ssize_t alarms_store(struct device *device, th = int_to_short(temp); /* Reorder if required th and tl */ - if (tl > th) { - tt = tl; tl = th; th = tt; - } + if (tl > th) + swap(tl, th); /* * Read the scratchpad to change only the required bits -- 2.51.0