Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1223197pxx; Tue, 27 Oct 2020 11:06:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwA1go4V6jnq78eEmWeAg0vurpwIv23WRZsaQTCEhZznsta7Nz+5/h5rsZY43T1SN2V2z19 X-Received: by 2002:a17:906:914a:: with SMTP id y10mr73068ejw.398.1603822018094; Tue, 27 Oct 2020 11:06:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603822018; cv=none; d=google.com; s=arc-20160816; b=l5vT2KAVQaFPwICeB6fp5rYiXSJ54Kt7tHLaya7JJAHwQiYT1RcLQ32/T5mx/vyWQl GYpspqWdxy24qkih1t7kCaQr04zYAb6Xr4m9G4SWW7h/tXYHPB+SYXXEf5ZobSMH0jp5 BLv6beiqR/gd3D97zfDMF0F1xq5wa4hrfyiq3Y3Zo7VTzK2Kcvh0Kg5+otNEyNkyydZG j8y/gawNGIXiyWPwg0zWNs8ygaPtprPoSHE7gbTneu5iG+B0qzTQajie/YNI2a8Svf/N WaX3SwAvznUGRs6/v3Kt3lcbkK4/uGq3ZHIsz0JJ6dc+NzA521FiN7ajY9ZPP0WAvqAg yCIw== 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=AJc09UCCQmCwIiyxkO7JRGyHKNw433aO9MO82IedQHM=; b=yQKXhW+1GI7rD3xXl0Ozd5AEoy+/pVoSCxIQZx53i5Lb1rEwKDNBXQMn1mXfrfJY6n sS0iTS8RxBjXzfYvzqWDV500XNzm2NNJ18RbTpsxwhtCF0rCSCRAmF/YhDC9kv2AVFfz WDQSMo1VlLitROAcgpU3SPmrWFu1IQJPHtQVTK/b/NmeWp4V0Sbbcql/iyqU6L0z3+rK ZTZDviA/0XqpSq2Wvph827+7ctEAbT4cXczlLp05F/RTMpXifstlKFjZW7jtFfJUch1G NEtFGWgZmsLmFXw+BoT8rcsy0+dFf/zHbi4dTNDr4EXJxAglwEV8LhnP3L1PB4rXf2S8 Br+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gh2nnahR; 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 l22si1535248ejc.719.2020.10.27.11.06.33; Tue, 27 Oct 2020 11:06:58 -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=gh2nnahR; 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 S1820820AbgJ0Riw (ORCPT + 99 others); Tue, 27 Oct 2020 13:38:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:33236 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760298AbgJ0Oe2 (ORCPT ); Tue, 27 Oct 2020 10:34:28 -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 343D020709; Tue, 27 Oct 2020 14:34:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809267; bh=ukGCmKdVlfLX/vv05S5i6v0UWlpxKaL8OxClYG3OUNI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gh2nnahRJGTUPnp/A1pAp1/AoOE3NcHMjdFKlpEZOXQ/oT96pLVuQNOlLFHgEuf5c pLCrhZ07eo6VcLJtcSPiybGtUcVhGJsgEhcJZI+xgxjPMDUwTRXT6onCyZrEK71Brl T9kFFHS9Z/tFsoIqckAo5F7zkptzzggl1k98n0a4= 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 5.4 135/408] video: fbdev: vga16fb: fix setting of pixclock because a pass-by-value error Date: Tue, 27 Oct 2020 14:51:13 +0100 Message-Id: <20201027135501.360734345@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@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 4b83109202b1c..3c4d20618de4c 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