stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Colin Ian King <colin.king@canonical.com>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Jani Nikula <jani.nikula@intel.com>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 4.4 040/112] video: fbdev: vga16fb: fix setting of pixclock because a pass-by-value error
Date: Tue, 27 Oct 2020 14:49:10 +0100	[thread overview]
Message-ID: <20201027134902.457540558@linuxfoundation.org> (raw)
In-Reply-To: <20201027134900.532249571@linuxfoundation.org>

From: Colin Ian King <colin.king@canonical.com>

[ Upstream commit c72fab81ceaa54408b827a2f0486d9a0f4be34cf ]

The pixclock is being set locally because it is being passed as a
pass-by-value argument rather than pass-by-reference, so the computed
pixclock is never being set in var->pixclock. Fix this by passing
by reference.

[This dates back to 2002, I found the offending commit from the git
history git://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git ]

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Jani Nikula <jani.nikula@intel.com>
[b.zolnierkie: minor patch summary fixup]
[b.zolnierkie: removed "Fixes:" tag (not in upstream tree)]
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200723170227.996229-1-colin.king@canonical.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/video/fbdev/vga16fb.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/video/fbdev/vga16fb.c b/drivers/video/fbdev/vga16fb.c
index 1acdb41a8a7c3..06cee2a40a9bf 100644
--- a/drivers/video/fbdev/vga16fb.c
+++ b/drivers/video/fbdev/vga16fb.c
@@ -243,7 +243,7 @@ static void vga16fb_update_fix(struct fb_info *info)
 }
 
 static void vga16fb_clock_chip(struct vga16fb_par *par,
-			       unsigned int pixclock,
+			       unsigned int *pixclock,
 			       const struct fb_info *info,
 			       int mul, int div)
 {
@@ -259,14 +259,14 @@ static void vga16fb_clock_chip(struct vga16fb_par *par,
 		{     0 /* bad */,    0x00, 0x00}};
 	int err;
 
-	pixclock = (pixclock * mul) / div;
+	*pixclock = (*pixclock * mul) / div;
 	best = vgaclocks;
-	err = pixclock - best->pixclock;
+	err = *pixclock - best->pixclock;
 	if (err < 0) err = -err;
 	for (ptr = vgaclocks + 1; ptr->pixclock; ptr++) {
 		int tmp;
 
-		tmp = pixclock - ptr->pixclock;
+		tmp = *pixclock - ptr->pixclock;
 		if (tmp < 0) tmp = -tmp;
 		if (tmp < err) {
 			err = tmp;
@@ -275,7 +275,7 @@ static void vga16fb_clock_chip(struct vga16fb_par *par,
 	}
 	par->misc |= best->misc;
 	par->clkdiv = best->seq_clock_mode;
-	pixclock = (best->pixclock * div) / mul;		
+	*pixclock = (best->pixclock * div) / mul;
 }
 			       
 #define FAIL(X) return -EINVAL
@@ -497,10 +497,10 @@ static int vga16fb_check_var(struct fb_var_screeninfo *var,
 
 	if (mode & MODE_8BPP)
 		/* pixel clock == vga clock / 2 */
-		vga16fb_clock_chip(par, var->pixclock, info, 1, 2);
+		vga16fb_clock_chip(par, &var->pixclock, info, 1, 2);
 	else
 		/* pixel clock == vga clock */
-		vga16fb_clock_chip(par, var->pixclock, info, 1, 1);
+		vga16fb_clock_chip(par, &var->pixclock, info, 1, 1);
 	
 	var->red.offset = var->green.offset = var->blue.offset = 
 	var->transp.offset = 0;
-- 
2.25.1




  parent reply	other threads:[~2020-10-27 18:27 UTC|newest]

Thread overview: 119+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-27 13:48 [PATCH 4.4 000/112] 4.4.241-rc1 review Greg Kroah-Hartman
2020-10-27 13:48 ` [PATCH 4.4 001/112] ibmveth: Identify ingress large send packets Greg Kroah-Hartman
2020-10-27 13:48 ` [PATCH 4.4 002/112] tipc: fix the skb_unshare() in tipc_buf_append() Greg Kroah-Hartman
2020-10-27 13:48 ` [PATCH 4.4 003/112] net/ipv4: always honour route mtu during forwarding Greg Kroah-Hartman
2020-10-27 13:48 ` [PATCH 4.4 004/112] r8169: fix data corruption issue on RTL8402 Greg Kroah-Hartman
2020-10-27 13:48 ` [PATCH 4.4 005/112] ALSA: bebob: potential info leak in hwdep_read() Greg Kroah-Hartman
2020-10-27 13:48 ` [PATCH 4.4 006/112] mm/kasan: print name of mem[set,cpy,move]() caller in report Greg Kroah-Hartman
2020-10-27 13:48 ` [PATCH 4.4 007/112] mm/kasan: add API to check memory regions Greg Kroah-Hartman
2020-10-27 13:48 ` [PATCH 4.4 008/112] compiler.h, kasan: Avoid duplicating __read_once_size_nocheck() Greg Kroah-Hartman
2020-10-27 13:48 ` [PATCH 4.4 009/112] compiler.h: Add read_word_at_a_time() function Greg Kroah-Hartman
2020-10-27 13:48 ` [PATCH 4.4 010/112] lib/strscpy: Shut up KASAN false-positives in strscpy() Greg Kroah-Hartman
2020-10-27 13:48 ` [PATCH 4.4 011/112] x86/mm/ptdump: Fix soft lockup in page table walker Greg Kroah-Hartman
2020-10-27 13:48 ` [PATCH 4.4 012/112] net: hdlc: In hdlc_rcv, check to make sure dev is an HDLC device Greg Kroah-Hartman
2020-10-27 13:48 ` [PATCH 4.4 013/112] net: hdlc_raw_eth: Clear the IFF_TX_SKB_SHARING flag after calling ether_setup Greg Kroah-Hartman
2020-10-27 13:48 ` [PATCH 4.4 014/112] nfc: Ensure presence of NFC_ATTR_FIRMWARE_NAME attribute in nfc_genl_fw_download() Greg Kroah-Hartman
2020-10-27 13:48 ` [PATCH 4.4 015/112] tcp: fix to update snd_wl1 in bulk receiver fast path Greg Kroah-Hartman
2020-10-27 13:48 ` [PATCH 4.4 016/112] icmp: randomize the global rate limiter Greg Kroah-Hartman
2020-10-27 13:48 ` [PATCH 4.4 017/112] cifs: remove bogus debug code Greg Kroah-Hartman
2020-10-27 13:48 ` [PATCH 4.4 018/112] ima: Dont ignore errors from crypto_shash_update() Greg Kroah-Hartman
2020-10-27 13:48 ` [PATCH 4.4 019/112] EDAC/i5100: Fix error handling order in i5100_init_one() Greg Kroah-Hartman
2020-10-27 13:48 ` [PATCH 4.4 020/112] crypto: ixp4xx - Fix the size used in a dma_free_coherent() call Greg Kroah-Hartman
2020-10-27 13:48 ` [PATCH 4.4 021/112] media: Revert "media: exynos4-is: Add missed check for pinctrl_lookup_state()" Greg Kroah-Hartman
2020-10-27 13:48 ` [PATCH 4.4 022/112] media: m5mols: Check function pointer in m5mols_sensor_power Greg Kroah-Hartman
2020-10-27 13:48 ` [PATCH 4.4 023/112] media: omap3isp: Fix memleak in isp_probe Greg Kroah-Hartman
2020-10-27 13:48 ` [PATCH 4.4 024/112] crypto: omap-sham - fix digcnt register handling with export/import Greg Kroah-Hartman
2020-10-27 13:48 ` [PATCH 4.4 025/112] media: tc358743: initialize variable Greg Kroah-Hartman
2020-10-27 13:48 ` [PATCH 4.4 026/112] media: ti-vpe: Fix a missing check and reference count leak Greg Kroah-Hartman
2020-10-27 13:48 ` [PATCH 4.4 027/112] ath6kl: prevent potential array overflow in ath6kl_add_new_sta() Greg Kroah-Hartman
2020-10-27 13:48 ` [PATCH 4.4 028/112] ath9k: Fix potential out of bounds in ath9k_htc_txcompletion_cb() Greg Kroah-Hartman
2020-10-27 13:48 ` [PATCH 4.4 029/112] wcn36xx: Fix reported 802.11n rx_highest rate wcn3660/wcn3680 Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 030/112] mwifiex: Do not use GFP_KERNEL in atomic context Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 031/112] drm/gma500: fix error check Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 032/112] scsi: qla4xxx: Fix an error handling path in qla4xxx_get_host_stats() Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 033/112] scsi: csiostor: Fix wrong return value in csio_hw_prep_fw() Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 034/112] backlight: sky81452-backlight: Fix refcount imbalance on error Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 035/112] VMCI: check return value of get_user_pages_fast() for errors Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 036/112] tty: serial: earlycon dependency Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 037/112] tty: hvcs: Dont NULL tty->driver_data until hvcs_cleanup() Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 038/112] pty: do tty_flip_buffer_push without port->lock in pty_write Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 039/112] drivers/virt/fsl_hypervisor: Fix error handling path Greg Kroah-Hartman
2020-10-27 13:49 ` Greg Kroah-Hartman [this message]
2020-10-27 13:49 ` [PATCH 4.4 041/112] video: fbdev: sis: fix null ptr dereference Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 042/112] HID: roccat: add bounds checking in kone_sysfs_write_settings() Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 043/112] ath6kl: wmi: prevent a shift wrapping bug in ath6kl_wmi_delete_pstream_cmd() Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 044/112] misc: mic: scif: Fix error handling path Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 045/112] ALSA: seq: oss: Avoid mutex lock for a long-time ioctl Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 046/112] quota: clear padding in v2r1_mem2diskdqb() Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 047/112] net: enic: Cure the enic api locking trainwreck Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 048/112] mfd: sm501: Fix leaks in probe() Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 049/112] usb: gadget: u_ether: enable qmult on SuperSpeed Plus as well Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 050/112] nl80211: fix non-split wiphy information Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 051/112] mwifiex: fix double free Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 052/112] net: korina: fix kfree of rx/tx descriptor array Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 053/112] IB/mlx4: Adjust delayed work when a dup is observed Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 054/112] powerpc/pseries: Fix missing of_node_put() in rng_init() Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 055/112] powerpc/icp-hv: Fix missing of_node_put() in success path Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 056/112] mtd: lpddr: fix excessive stack usage with clang Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 057/112] mtd: mtdoops: Dont write panic data twice Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 058/112] ARM: 9007/1: l2c: fix prefetch bits init in L2X0_AUX_CTRL using DT values Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 059/112] powerpc/tau: Use appropriate temperature sample interval Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 060/112] powerpc/tau: Remove duplicated set_thresholds() call Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 061/112] powerpc/tau: Disable TAU between measurements Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 062/112] perf intel-pt: Fix "context_switch event has no tid" error Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 063/112] kdb: Fix pager search for multi-line strings Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 064/112] powerpc/perf/hv-gpci: Fix starting index value Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 065/112] cpufreq: powernv: Fix frame-size-overflow in powernv_cpufreq_reboot_notifier Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 066/112] lib/crc32.c: fix trivial typo in preprocessor condition Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 067/112] vfio/pci: Clear token on bypass registration failure Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 068/112] Input: imx6ul_tsc - clean up some errors in imx6ul_tsc_resume() Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 069/112] Input: ep93xx_keypad - fix handling of platform_get_irq() error Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 070/112] Input: omap4-keypad " Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 071/112] Input: sun4i-ps2 " Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 072/112] KVM: x86: emulating RDPID failure shall return #UD rather than #GP Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 073/112] memory: omap-gpmc: Fix a couple off by ones Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 074/112] memory: fsl-corenet-cf: Fix handling of platform_get_irq() error Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 075/112] arm64: dts: zynqmp: Remove additional compatible string for i2c IPs Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 076/112] powerpc/powernv/dump: Fix race while processing OPAL dump Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 077/112] media: firewire: fix memory leak Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 078/112] media: ati_remote: sanity check for both endpoints Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 079/112] media: exynos4-is: Fix several reference count leaks due to pm_runtime_get_sync Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 080/112] media: exynos4-is: Fix a reference count leak " Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 081/112] media: exynos4-is: Fix a reference count leak Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 082/112] media: bdisp: Fix runtime PM imbalance on error Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 083/112] media: media/pci: prevent memory leak in bttv_probe Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 084/112] media: uvcvideo: Ensure all probed info is returned to v4l2 Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 085/112] mmc: sdio: Check for CISTPL_VERS_1 buffer size Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 086/112] media: saa7134: avoid a shift overflow Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 087/112] ntfs: add check for mft record size in superblock Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 088/112] PM: hibernate: remove the bogus call to get_gendisk() in software_resume() Greg Kroah-Hartman
2020-10-27 13:49 ` [PATCH 4.4 089/112] scsi: mvumi: Fix error return in mvumi_io_attach() Greg Kroah-Hartman
2020-10-27 13:50 ` [PATCH 4.4 090/112] scsi: target: core: Add CONTROL field for trace events Greg Kroah-Hartman
2020-10-27 13:50 ` [PATCH 4.4 091/112] usb: gadget: function: printer: fix use-after-free in __lock_acquire Greg Kroah-Hartman
2020-10-27 13:50 ` [PATCH 4.4 092/112] udf: Limit sparing table size Greg Kroah-Hartman
2020-10-27 13:50 ` [PATCH 4.4 093/112] udf: Avoid accessing uninitialized data on failed inode read Greg Kroah-Hartman
2020-10-27 13:50 ` [PATCH 4.4 094/112] ath9k: hif_usb: fix race condition between usb_get_urb() and usb_kill_anchored_urbs() Greg Kroah-Hartman
2020-10-27 13:50 ` [PATCH 4.4 095/112] misc: rtsx: Fix memory leak in rtsx_pci_probe Greg Kroah-Hartman
2020-10-27 13:50 ` [PATCH 4.4 096/112] reiserfs: only call unlock_new_inode() if I_NEW Greg Kroah-Hartman
2020-10-27 13:50 ` [PATCH 4.4 097/112] xfs: make sure the rt allocator doesnt run off the end Greg Kroah-Hartman
2020-10-27 13:50 ` [PATCH 4.4 098/112] usb: ohci: Default to per-port over-current protection Greg Kroah-Hartman
2020-10-27 13:50 ` [PATCH 4.4 099/112] Bluetooth: Only mark socket zapped after unlocking Greg Kroah-Hartman
2020-10-27 13:50 ` [PATCH 4.4 100/112] scsi: ibmvfc: Fix error return in ibmvfc_probe() Greg Kroah-Hartman
2020-10-27 13:50 ` [PATCH 4.4 101/112] brcmsmac: fix memory leak in wlc_phy_attach_lcnphy Greg Kroah-Hartman
2020-10-27 13:50 ` [PATCH 4.4 102/112] rtl8xxxu: prevent potential memory leak Greg Kroah-Hartman
2020-10-27 13:50 ` [PATCH 4.4 103/112] Fix use after free in get_capset_info callback Greg Kroah-Hartman
2020-10-27 13:50 ` [PATCH 4.4 104/112] tty: ipwireless: fix error handling Greg Kroah-Hartman
2020-10-27 13:50 ` [PATCH 4.4 105/112] ipvs: Fix uninit-value in do_ip_vs_set_ctl() Greg Kroah-Hartman
2020-10-27 13:50 ` [PATCH 4.4 106/112] reiserfs: Fix memory leak in reiserfs_parse_options() Greg Kroah-Hartman
2020-10-27 13:50 ` [PATCH 4.4 107/112] brcm80211: fix possible memleak in brcmf_proto_msgbuf_attach Greg Kroah-Hartman
2020-10-27 13:50 ` [PATCH 4.4 108/112] usb: core: Solve race condition in anchor cleanup functions Greg Kroah-Hartman
2020-10-27 13:50 ` [PATCH 4.4 109/112] ath10k: check idx validity in __ath10k_htt_rx_ring_fill_n() Greg Kroah-Hartman
2020-10-27 13:50 ` [PATCH 4.4 110/112] net: korina: cast KSEG0 address to pointer in kfree Greg Kroah-Hartman
2020-10-27 13:50 ` [PATCH 4.4 111/112] usb: cdc-acm: add quirk to blacklist ETAS ES58X devices Greg Kroah-Hartman
2020-10-27 13:50 ` [PATCH 4.4 112/112] USB: cdc-wdm: Make wdm_flush() interruptible and add wdm_fsync() Greg Kroah-Hartman
2020-10-28 13:50 ` [PATCH 4.4 000/112] 4.4.241-rc1 review Naresh Kamboju
2020-10-28 15:54 ` Pavel Machek
2020-10-28 19:28 ` Jon Hunter
     [not found] ` <20201028170621.GA118534@roeck-us.net>
2020-10-28 19:46   ` Guenter Roeck
2020-10-28 20:33     ` Daniel Díaz
2020-10-28 20:47       ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201027134902.457540558@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=b.zolnierkie@samsung.com \
    --cc=colin.king@canonical.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=jani.nikula@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).