Skip to contentSkip to conversation

Patch "media: ts2020: avoid integer overflows on 32 bit machines" has been added to the 4.14-stable tree

PATCH [email protected] 1 participant 1 message Feb 15, 2018

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

media: ts2020: avoid integer overflows on 32 bit machines

to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
media-ts2020-avoid-integer-overflows-on-32-bit-machines.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 81742be14b6a90c9fd0ff6eb4218bdf696ad8e46 Mon Sep 17 00:00:00 2001

From: Mauro Carvalho Chehab <[email protected]>
Date: Wed, 10 Jan 2018 07:20:39 -0500
Subject: media: ts2020: avoid integer overflows on 32 bit machines

From: Mauro Carvalho Chehab <[email protected]>

commit 81742be14b6a90c9fd0ff6eb4218bdf696ad8e46 upstream.

Before this patch, when compiled for arm32, the signal strength were reported as:

Lock (0x1f) Signal= 4294908.66dBm C/N= 12.79dB

Because of a 32 bit integer overflow. After it, it is properly reported as:

	Lock   (0x1f) Signal= -58.64dBm C/N= 12.79dB
Fixes 0f91c9d6bab9 ("[media] TS2020: Calculate tuner gain correctly")
---
 drivers/media/dvb-frontends/ts2020.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/dvb-frontends/ts2020.c +2 -2
@@ -368,7 +368,7 @@ static int ts2020_read_tuner_gain(struct
 		gain2 = clamp_t(long, gain2, 0, 13);
 		v_agc = clamp_t(long, v_agc, 400, 1100);
 
-		*_gain = -(gain1 * 2330 +
+		*_gain = -((__s64)gain1 * 2330 +
 			   gain2 * 3500 +
 			   v_agc * 24 / 10 * 10 +
 			   10000);
@@ -386,7 +386,7 @@ static int ts2020_read_tuner_gain(struct
 		gain3 = clamp_t(long, gain3, 0, 6);
 		v_agc = clamp_t(long, v_agc, 600, 1600);
 
-		*_gain = -(gain1 * 2650 +
+		*_gain = -((__s64)gain1 * 2650 +
 			   gain2 * 3380 +
 			   gain3 * 2850 +
 			   v_agc * 176 / 100 * 10 -

Patches currently in stable-queue which might be from [email protected] are

queue-4.14/media-hdpvr-fix-an-error-handling-path-in-hdpvr_probe.patch queue-4.14/media-v4l2-compat-ioctl32.c-copy-m.userptr-in-put_v4l2_plane32.patch queue-4.14/media-v4l2-compat-ioctl32.c-avoid-sizeof-type.patch queue-4.14/media-v4l2-compat-ioctl32.c-drop-pr_info-for-unknown-buffer-type.patch queue-4.14/media-dvb-usb-v2-lmedm04-move-ts2020-attach-to-dm04_lme2510_tuner.patch queue-4.14/media-v4l2-compat-ioctl32.c-add-missing-vidioc_prepare_buf.patch queue-4.14/media-v4l2-compat-ioctl32.c-refactor-compat-ioctl32-logic.patch queue-4.14/media-v4l2-compat-ioctl32.c-fix-ctrl_is_pointer.patch queue-4.14/media-dvb-frontends-fix-i2c-access-helpers-for-kasan.patch queue-4.14/media-dvb-usb-v2-lmedm04-improve-logic-checking-of-warm-start.patch queue-4.14/media-v4l2-compat-ioctl32.c-move-helper-functions-to-__get-put_v4l2_format32.patch queue-4.14/media-ts2020-avoid-integer-overflows-on-32-bit-machines.patch queue-4.14/media-v4l2-compat-ioctl32.c-don-t-copy-back-the-result-for-certain-errors.patch queue-4.14/media-v4l2-compat-ioctl32.c-make-ctrl_is_pointer-work-for-subdevs.patch queue-4.14/media-v4l2-compat-ioctl32.c-fix-the-indentation.patch queue-4.14/media-v4l2-ioctl.c-don-t-copy-back-the-result-for-enotty.patch queue-4.14/media-v4l2-ioctl.c-use-check_fmt-for-enum-g-s-try_fmt.patch queue-4.14/media-v4l2-compat-ioctl32.c-copy-clip-list-in-put_v4l2_window32.patch