Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp175604pxx; Wed, 28 Oct 2020 01:39:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzV3XiFlPLuxei/H6X8jWMpeQIyNLw24bwOrut0SkITe1Cw4sWk2yeV//LaYom2x7OfBCue X-Received: by 2002:a17:906:a250:: with SMTP id bi16mr5998706ejb.265.1603874376690; Wed, 28 Oct 2020 01:39:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603874376; cv=none; d=google.com; s=arc-20160816; b=glWKBwmSW1BOVzz/vME54KFNM9Z9Twrfl9GvJEzs9UuTqw2LGDJHbI/QS2HK2DQDdJ nE/UQtjqLk5bFrGbZ+JpU6UkON8lxZ9Tj1NKCAhuXFn7PVq6pMtV64G96nhD5rcNFOa0 Wp1mFYROdM6jkItJLunXNyoHfwls0ZWAiKYCXZP5iW/ojCKYFrX3ojMmfqFqGIKQ0bJX MmSF957UKcMnq4tPttUzCp144avElvyFHmYgT3nk/aTzGDLx2G8TuCNmDjlbLy68shS6 1/dqQxwCiXA5s/BMYWqBvad9J9C/jzxKwD2bNqwzgo3ejLxJt5IyDcPW3TdGocEKiOK2 O6pg== 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=pMc+8xREQkN00w7c/74inkbrFEMN8BUaIt88JNJmprs=; b=huXc+wV9V+xRXLTrQZi8wORNepKnKDjMSU7aXRsLDoCnKIjeNQq5wxC/QQqQS029c4 c0K5BIgy2MpstryovM7Caz6efNTEyCnW6bDOXj9cZLI6Cfo+1KQ7FdsmnAGe3aPw/xeS OhzEq5fi/H6i+t515cHaRfr6RV7Bg8fYpqcXOdDdF4uxltQSwKtsUUTlakTkgZr62jDe 2GbKZD/9Ji7A7c+QeCiGYRAx1GWPhYU3P8bSA8gjCMGHUpA0vLaJzHDEJzamvnZYw9Km +Pj/QlVGYY8ofcrc2z5X/RFE52OUduim5uoSnbruqP1lg4rqTHaG/V51n4h8xfyBN8OE cDCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=x8BL5Dbk; 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 p17si2879649ejg.48.2020.10.28.01.39.14; Wed, 28 Oct 2020 01:39:36 -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=x8BL5Dbk; 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 S1754823AbgJ0OHQ (ORCPT + 99 others); Tue, 27 Oct 2020 10:07:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:52998 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754226AbgJ0OEm (ORCPT ); Tue, 27 Oct 2020 10:04:42 -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 54C682222C; Tue, 27 Oct 2020 14:04:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807482; bh=gs572yzi9DtUTqIEsOp/fXLzap33LPim28JRC4DjSJ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x8BL5Dbke7Rojb9rW0eObR2PFkAsHihCW1S5AfIhWGeusdskurmLB3GdUN+/Q53Ew tkhDUEXv3jyoG01qtRfHbv7w45vBfktBFw5AT6yZQFjfLimxddtg/z9K5yk/GTLfaS DyX43J6hUVLRozqDFBtlmE8iSljx6xZw4eJStUII= 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.9 040/139] video: fbdev: vga16fb: fix setting of pixclock because a pass-by-value error Date: Tue, 27 Oct 2020 14:48:54 +0100 Message-Id: <20201027134904.037893878@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134902.130312227@linuxfoundation.org> References: <20201027134902.130312227@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 ee6957a799bb6..aea8fd85cbf70 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