From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796385753; b=E3AFckgak7+0kwuOJxbcLaHRObqy57kz8/70OGUx8dIKuBGHVOExcdCM6whjqt55MbXP vpD89Z2E0dn/JkYiztDkN4WkUUKfzDzMOctPrdYWyjLXVR8iaL2HN0MsobrY5zM+6IIjr uH/TVJHlEztPu5NHo4krz+XuCfDctr/gJz/klbiYBFw6qTdeKVhQV33WNU8A8Ju2c0+g7 FsXjtr5Y0t99MxoArToLerzhqrAucDCDVVn0G3N1dkvcLn/kXvaRSF1jWxtCGMh+1xVF+ jOCJ37kAQqD08qL4A2JVNSQgfNguaG04aV0xRIN9ipm/at2daIz4YFaPKeA/YfFJKaA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385753; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=REfjintDFLYHB7ChWjLkWHqrpYghPXEThU55589y5hA=; b=JywQ8h7K34ur14vSQKNQgT3l/h+NNVfjanhf+fen8092Pm7CaekEeJyS4YKD1wrVl6JZ QTF+kF0SoIlVps0uuihLRSgvexoJB+zr8HD7nqt19q/jBj7pJlqthQUizcyKYqzmfDzQP 2IlqSlJdiaP5pyxwPAgiEvJ2r30fSNg7fCNEXIgMrULUn7nE4AUIKihs0nMeJ7AS2VTv8 5tQjUSb5kCkE//uus93DlWFCYyThfQFXxy7rT4Hnf++IfH3ICdo5LKGB40P7fSq2ypUvo UgPW7H1SEdgmCzjxL8xhZMwD9j+yOwZ9ZgKzTXEHS4aBz8R43IiHIjICF2ht0G4AhsA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=WhJ7okqz; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EAC5F606A332; Fri, 4 Dec 2026 12:02:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=WhJ7okqz Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68BB61F000C2; Fri, 4 Dec 2026 12:02:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385752; bh=REfjintDFLYHB7ChWjLkWHqrpYghPXEThU55589y5hA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=WhJ7okqz6k6RBdV24ACHu58blP6IyVmXQld19ePRy+NYLnpL3aLfdzrcMy6OyxacF by3PrQ1uF4fXBGexFgvbCEeoC0BACRUxP/VAR5sIAIopqiHDXLALVYupUWSiM9B1Ja zdI5ZsLp/y04D7lJU2to33XLnK0S3EpKFH29ALb0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Josef Bacik , Srinivas Pandruvada , Jonathan Cameron Subject: [PATCH 6.6 0630/1167] iio: hid-sensors: fix a division by zero Date: Fri, 4 Dec 2026 19:00:57 +0900 Message-ID: <20261204100718.470174502@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Josef Bacik commit fd4c92bbd3a64556e81042ff8d30545b15a3b93a upstream. convert_to_vtf_format() divides the micro part of a value by 10^(6 + exp). The unit exponent of a HID field is a nibble and goes down to -8. For -7 and -8 the argument of int_pow() is negative, which the unsigned parameter turns into a huge power of ten: 0 modulo 2^64. The division by it is a divide error. The exponent comes from the report descriptor of the sensor hub, the value from a write to the hysteresis attribute of the IIO device. Multiply by 10^(-exp - 6) in these two cases. Fixes: 73c6768b710a ("iio: hid-sensors: Common attribute and trigger") Cc: stable Signed-off-by: Josef Bacik Signed-off-by: Greg Kroah-Hartman Acked-by: Srinivas Pandruvada Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/common/hid-sensors/hid-sensor-attributes.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c +++ b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c @@ -137,7 +137,10 @@ static u32 convert_to_vtf_format(int siz if (val1 < 0 || val2 < 0) sign = -1; exp = hid_sensor_convert_exponent(exp); - if (exp < 0) { + if (exp < -6) { + value = abs(val1) * int_pow(10, -exp); + value += abs(val2) * int_pow(10, -exp - 6); + } else if (exp < 0) { divisor = int_pow(10, 6 + exp); value = abs(val1) * int_pow(10, -exp); value += abs(val2) / divisor;