Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp160185pxx; Wed, 28 Oct 2020 01:07:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzsnqVP5nIbzkbbhoPncDHvQbPyJP59fGZ9bewD+5tNx+f1yimcoD0WYjJoTJZfJYW17lq/ X-Received: by 2002:a17:906:a195:: with SMTP id s21mr6181595ejy.146.1603872449236; Wed, 28 Oct 2020 01:07:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603872449; cv=none; d=google.com; s=arc-20160816; b=hUsSTrbbtcktOEQtZgWx91qo3M5FH39wPZ66x5WYPjcweSYWFgNxsTRxc01tMUQ5Q9 eNbw9GwFa+J3LdWP5otJT7dbhCIbXDUBTlq1SsbJU9dyVpiGOEAcimfjEqhcqzAJxAEj CwEAmPK4Ho2sSqaNLTYGcRgbws8hHHqXxfbnxBIkqViUdL/5mUuSqn4k33FncKKaXf1i +btWo3nUq0cLz0dpodYz16uWgzaweViQ/za3Yb22NHlcvJyw6uri+dy8CI0kantlumzZ WgwYgHS+bsVEopKb19xlk2lMkk+ruv4ps9uvvhrU+Eyj4ieSAXssqTxGGZmgeP0t2S8v oBtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Pw3B984Hn1qw0CGNWHj1HKMLVf6K12Lq0+WbRr0F6U4=; b=mYXyZRSV0JizmdH7rNfiE7p7BqnS2uEKZ1NmcQl6OR55GnFiWdeiYu5XD1PopDQmGr 826YZyO4gtKBn8v/vqQK59zWAW9y/5dBkTWB8WrfArIi8JgnJQjC1Ss49bdD4FZjg/TP 6TgOvTbWnDYzzBn8+AFPie1QnV8VBlH48NI9QabyehB3KSqK4n4S+2sCGaENjp+sDNrE 0eD9CoJ6+513gHcFWOpfHv3j3HcIJaX35gcJKorv+VWngIyXSwmWt2FXcOkNwDOX09pA lyWZibBCIlX9jDQnD8nWk4z2g5NCpBuTzErMbExrLNPosnlKoBQJ6Mq0JYDTZAkmB7d2 QmjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qZykBkuW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g1si3663191edn.100.2020.10.28.01.07.07; Wed, 28 Oct 2020 01:07:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qZykBkuW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753048AbgJ0N6P (ORCPT + 99 others); Tue, 27 Oct 2020 09:58:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:45428 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753037AbgJ0N6N (ORCPT ); Tue, 27 Oct 2020 09:58:13 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 645B32068D; Tue, 27 Oct 2020 13:58:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807091; bh=0oD6PhTOeavVEdiL2JrbYcpS4bpz+YRJxwNii4zfHOY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qZykBkuWX8Id83WXZGQNVkhm7YXq8wtJWhckajC92m0R5/URZI4kUbcHltGbF+AgS RbqjxmpgXJixOrghzSmZpbKlRtQxwfaXTYFB3tdCRGIiQvNDtr93YpgpMG/6GxWpYU aIO+bKoaPzPsrMZ0Jy6jkFIjb63Kfn8gCo+4C4t0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , Daniel Vetter , Jani Nikula , Bartlomiej Zolnierkiewicz , Sasha Levin 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 Message-Id: <20201027134902.457540558@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134900.532249571@linuxfoundation.org> References: <20201027134900.532249571@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King [ 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 Cc: Daniel Vetter Cc: Jani Nikula [b.zolnierkie: minor patch summary fixup] [b.zolnierkie: removed "Fixes:" tag (not in upstream tree)] Signed-off-by: Bartlomiej Zolnierkiewicz Link: https://patchwork.freedesktop.org/patch/msgid/20200723170227.996229-1-colin.king@canonical.com Signed-off-by: Sasha Levin --- 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