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 04E822868B4 for ; Fri, 15 May 2026 05:23:31 +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=1778822612; cv=none; b=Hb2J+Q+Hj4cAhnHGcjV63eKZ4QUjjgdf0+/j6WqPsB1W+sPLMty5SFd9FVFyKjhEe2/l9Rv+YMhgcv4dOrjUAZZJPyNVfb0APifTmRoVGWcBvtz3gj1ex4KIZJT1zr4AODYf81oNorK8Vay3SIcLQ54rm7IVdItUwr4wm4qJ6I0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778822612; c=relaxed/simple; bh=PTDmn+VErWkeFbnmm/prNrLM8Af7yGsqDmYhZYlo2I4=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=DFYj6yyTEzsATvV9Zh3KB5xPnwUQm62tM7xTQ8gvRJzJFHM99LlYPWRrN/VxBQ5BvAUayzVeynQOIX9/WywdbRKgEQKx9mf07BuPDf7ddhyEPGxcyiwtFy0eF5vJwUCm4NIHvX8MDaQ8zBguJa7hTjd7aRD8ZKQdDvP6TuIlnlg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=uc5W3Z3M; 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="uc5W3Z3M" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4344EC2BCB0; Fri, 15 May 2026 05:23:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1778822611; bh=PTDmn+VErWkeFbnmm/prNrLM8Af7yGsqDmYhZYlo2I4=; h=Subject:To:Cc:From:Date:From; b=uc5W3Z3MiP2xgaaFk3la3/b/Vvhwiuyro/KEPKD5GXBtnn5gdKBQTi3ulqLMohUut 7d7fzpNbwYCXIQ9sa5mThITop6cV9H4Y3NDP799O8zbQxFBan33jnc6qj2ZdETjlYa ZBXcrT8r2B5nG5i8pDfhhMeLaJ7fk47NRpMPxlnM= Subject: FAILED: patch "[PATCH] HID: pidff: Fix integer overflow in pidff_rescale" failed to apply to 5.10-stable tree To: tomasz.pakula.oficjalny@gmail.com,jkosina@suse.com Cc: From: Date: Fri, 15 May 2026 07:23:23 +0200 Message-ID: <2026051523-jolly-unwired-ab88@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The patch below does not apply to the 5.10-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y git checkout FETCH_HEAD git cherry-pick -x 48d1677779ad6816978ad4a4f7588aec5ec960fe # git commit -s git send-email --to '' --in-reply-to '2026051523-jolly-unwired-ab88@gregkh' --subject-prefix 'PATCH 5.10.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 48d1677779ad6816978ad4a4f7588aec5ec960fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Paku=C5=82a?= Date: Sun, 10 May 2026 14:23:52 +0200 Subject: [PATCH] HID: pidff: Fix integer overflow in pidff_rescale MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rescaling values close to the max (U16_MAX) temporarily creates values that exceed the s32 range. This caused value overflow in case when, for example, a periodic effect phase was higer than 180 degrees. In turn, rescale function could return values outised of the logical range of the HID field. Fix by using 64 bit signed integer to store the value during calculation but still return only 32 bit integer. Closes: https://github.com/JacKeTUs/universal-pidff/issues/116 Fixes: 224ee88fe395 ("Input: add force feedback driver for PID devices") Cc: stable@vger.kernel.org Signed-off-by: Tomasz PakuĊ‚a Signed-off-by: Jiri Kosina diff --git a/drivers/hid/usbhid/hid-pidff.c b/drivers/hid/usbhid/hid-pidff.c index aee8a4443305..c45f182d0448 100644 --- a/drivers/hid/usbhid/hid-pidff.c +++ b/drivers/hid/usbhid/hid-pidff.c @@ -11,6 +11,7 @@ #include "hid-pidff.h" #include #include +#include #include #include #include @@ -326,8 +327,10 @@ static s32 pidff_clamp(s32 i, struct hid_field *field) */ static int pidff_rescale(int i, int max, struct hid_field *field) { - return i * (field->logical_maximum - field->logical_minimum) / max + - field->logical_minimum; + /* 64 bits needed for big values during rescale */ + s64 result = field->logical_maximum - field->logical_minimum; + + return div_s64(result * i, max) + field->logical_minimum; } /*