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 CEDA01DF73C; Tue, 29 Apr 2025 17:05:04 +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=1745946304; cv=none; b=iYpeIfD4r8Bb5GFpAubXT7iRoQVYJLi7Qp1RdyEfI8Lp3/BaUcRHhKg5WPnPoAQ3ox0xYTjXYcUmVdCdNhhys40OktvRTZJi6u0caeSQXJXBJSx6sDpuo+8wMLUOY+ZfAniQiMjDsg7YSoW4/IoLLgvFYOgb7MTuw1eqHik2mto= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745946304; c=relaxed/simple; bh=wxg6Rv/DXOa9HAY5c51rQkSxJ3HmkFZHdlZCSX4Hfto=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ErZYOlH9dfWL5jTYwo3sx1wCtxyfFw5y1Y5bPq0TSn7hX4dIrwwCqAAEDR3pqdQmN8SZloW4L+cTt+TKSMHBEH9v1AabXTpKaKYEs6YiuRs3luZlTdiaMSChaW0zXSdeDeFvERKpTgwQ/rIBnnxpvB4/M2WFWXa/nq3C+NigjZA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ZccOtRzC; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ZccOtRzC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E825EC4CEE9; Tue, 29 Apr 2025 17:05:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1745946304; bh=wxg6Rv/DXOa9HAY5c51rQkSxJ3HmkFZHdlZCSX4Hfto=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZccOtRzCFyTIasWQLlcggRwD20odN4RYdLoEyGl+k5mRavvcVWxRCA47dL6rNLbYp NqEK80qnyWEjQqH9eeRWFKwOy8isq/q6HPu0516sIFBEnRHCjmGxV7901kaXMZYuYR eSAmgDxqhh3fxe67U4AwoFqD5Hz8szOd4ZmRrGg8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, kernel test robot , Josh Poimboeuf , Ingo Molnar , Mark Brown , Srinivas Kandagatla , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Linus Torvalds , Sasha Levin Subject: [PATCH 6.14 223/311] objtool, ASoC: codecs: wcd934x: Remove potential undefined behavior in wcd934x_slim_irq_handler() Date: Tue, 29 Apr 2025 18:41:00 +0200 Message-ID: <20250429161130.153382111@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250429161121.011111832@linuxfoundation.org> References: <20250429161121.011111832@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Josh Poimboeuf [ Upstream commit 060aed9c0093b341480770457093449771cf1496 ] If 'port_id' is negative, the shift counts in wcd934x_slim_irq_handler() also become negative, resulting in undefined behavior due to shift out of bounds. If I'm reading the code correctly, that appears to be not possible, but with KCOV enabled, Clang's range analysis isn't always able to determine that and generates undefined behavior. As a result the code generation isn't optimal, and undefined behavior should be avoided regardless. Improve code generation and remove the undefined behavior by converting the signed variables to unsigned. Fixes the following warning with UBSAN: sound/soc/codecs/snd-soc-wcd934x.o: warning: objtool: .text.wcd934x_slim_irq_handler: unexpected end of section Reported-by: kernel test robot Signed-off-by: Josh Poimboeuf Signed-off-by: Ingo Molnar Acked-by: Mark Brown Cc: Srinivas Kandagatla Cc: Liam Girdwood Cc: Jaroslav Kysela Cc: Takashi Iwai Cc: Linus Torvalds Link: https://lore.kernel.org/r/7e863839ec7301bf9c0f429a03873d44e484c31c.1742852847.git.jpoimboe@kernel.org Closes: https://lore.kernel.org/oe-kbuild-all/202503180044.oH9gyPeg-lkp@intel.com/ Signed-off-by: Sasha Levin --- sound/soc/codecs/wcd934x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/wcd934x.c b/sound/soc/codecs/wcd934x.c index 910852eb9698c..c7f1b28f3b230 100644 --- a/sound/soc/codecs/wcd934x.c +++ b/sound/soc/codecs/wcd934x.c @@ -2273,7 +2273,7 @@ static irqreturn_t wcd934x_slim_irq_handler(int irq, void *data) { struct wcd934x_codec *wcd = data; unsigned long status = 0; - int i, j, port_id; + unsigned int i, j, port_id; unsigned int val, int_val = 0; irqreturn_t ret = IRQ_NONE; bool tx; -- 2.39.5