From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mta1.migadu.com (out-225.mta1.migadu.com [95.215.58.225]) (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 31B203DFC7F for ; Wed, 23 Sep 2026 09:20:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.225 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790155222; cv=none; b=HIPEpNkTTLGJTt/SVFsew4C7ktWXqNIFV2NgM12i8xsVUeBqGTKKbJUVz935nrzcVwQb2w2HB3tOXs+LP54LRpJYvLP6tBUq0qe2Twr15Hh2fp69FumsmRXUnco4XrrUy2GFG7g3uzz39PsZqz2Z+0zBVwkk5Gv02fdP1K9Q/j0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790155222; c=relaxed/simple; bh=YMhS+fdcs05Fz41Krh16jBe0uGQOm1VcPnksCJC5d8Y=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=clxa0HnjOmk3Nccab1Wk9jvI48g3a6v29dK7tJiCaAlttMYZuD+7R4/juIU3FRr6JMuNMjTstk6eJUzw9dHlmJZ7SqAbLtHS7sEKsx88nRRXjdS2mqRMuooREIQEhynqFjOPj10NG2WrUejW2ZZAtxmonddkmYZQkAeYek5TIx0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=jJT0I39b; arc=none smtp.client-ip=95.215.58.225 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="jJT0I39b" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=YMhS+fdcs05Fz41Krh16jBe0uGQOm1VcPnksCJC5d8Y=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1790155217; v=1; x=1790760017; b=jJT0I39bXhD6GU542Mp5YztveUpOS93TC4EEHgwU2Okkw7FLq2uBTlIzeyezcRNEuejK+v5O q+5pMywxK7aEqraBNCG8JCiMSTgtns0MV7S1dh9GE0TCnjxinBkQgNnBvMlv0oRUmmhmKCEZjgj 9sqEyVbkJH6K2Kn8T5AZq9xw= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 78a4c3ba66ae85bc; Wed, 23 Sep 2026 09:20:15 +0000 X-Mizu-Trace-ID: 78a4c3ba66ae85bc X-Migadu-Flow: FLOW_OUT Message-ID: <5e42a314-41f6-484a-8c3d-c913b5405889@linux.dev> Date: Wed, 23 Sep 2026 17:20:10 +0800 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 v3] irqchip/gic: Fix UBSAN shift-out-of-bounds in GIC helpers To: Zhu Ling Cc: maz@kernel.org, tglx@kernel.org, radu@rendec.net, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <6b668efe-ef7a-474a-957c-893755ebba46@linux.dev> <20260923082804.13197-1-zhuling2709@phytium.com.cn> Content-Language: en-US From: Zenghui Yu In-Reply-To: <20260923082804.13197-1-zhuling2709@phytium.com.cn> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 9/23/26 4:28 PM, Zhu Ling wrote: > When running with UBSAN enabled, enabling a GPIO controller that uses a > GIC interrupt as its parent triggers several shift-out-of-bounds warnings: > > shift-out-of-bounds in drivers/irqchip/irq-gic-common.c:50:21 > left shift of 2 by 30 places cannot be represented in type 'int' > > Similar reports are emitted from gic_poke_irq() and gic_peek_irq() in > drivers/irqchip/irq-gic-v3.c. The corresponding GICv2 helpers use the > same signed-shift pattern. These masks are generated by shifting signed > integer constants, which invokes undefined behavior when bit 31 is > selected. > > Use BIT() to generate the masks with an unsigned type and make their > intent explicit. > > Signed-off-by: Zhu Ling > --- > Changes in v3: > - Fix the same issue in the GICv2 gic_poke_irq() and gic_peek_irq() > helpers, as pointed out by Zenghui. > > Changes in v2: > - Use BIT() instead of explicit unsigned shifts, as suggested by Marc. > - Drop the redundant introductory text from the email. > - Update the author email address. > > Link: https://lore.kernel.org/r/2fJDwUUYdEf2_eaRa041L9xkT8RkSWFeo7euOnqMbbPhUatLlEaAvGfB6sOspDmXaxO87Eh7bQLV9UolyjbMtZBT1wB2UGypjPOo0Z-RC0Q=@proton.me > --- > drivers/irqchip/irq-gic-common.c | 2 +- > drivers/irqchip/irq-gic-v3.c | 4 ++-- > drivers/irqchip/irq-gic.c | 4 ++-- > 3 files changed, 5 insertions(+), 5 deletions(-) Looks good, Reviewed-by: Zenghui Yu (Huawei) Thanks, Zenghui