Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1317010yba; Tue, 2 Apr 2019 06:45:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqzszI2ayufMTHitBpBnKrEuY6Ej9xumkywL+dOiXqrEc0kvGn5Tj74SEw74B5zaA1IRMOTF X-Received: by 2002:a63:5a20:: with SMTP id o32mr64106813pgb.225.1554212755582; Tue, 02 Apr 2019 06:45:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554212755; cv=none; d=google.com; s=arc-20160816; b=KX0nLaT2V2qHGP1PS0IZSX82db7Cpuj/ZA6bxGu3mPYzANPFrEOAnLpoVk3f2FYDc2 0RKZi3e5k8r5qbHGpZdqU57UJauU54TZthAr9aQRyCE207m14HCw4TWoZQprEbUxuQ8C /8Y3j5HN6qB3fPF/mtEGt+dJrzGX93nbAzdHdeduwfOZjNKFyVbUvre01FIR8wD3gCNc JIPe5x7vEM1llRUGnSE9jjdZxBgC4NKZKTY9ODaceGfMnF17d6ToJe28kAbNI9H0cgfY RFiwFty1q+c/sN4quCQz1bvPZII5kXXKcKn0KulSnoY6m16GXWssSeibQ7HciKlu/znx 5KCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=KDMWjkih/+p9szYrMjoq0qCQkxBfRcYv8LhIq85CgM4=; b=hIzKRJbLiyYICND0CNHgjY6Pvjax75EoBq44uAAd/x0xj2lFFwZjx+9Y50fhFAdJ/K gr63DT9+zcbud3vUT6Vp69Y8tuCYIdr8WJMgAtTaWlcJ6KGpXsbgiKLpMWJbxpxoFQND 9d4mLXv55Sf7s9MaEkfn52jpnoQiACHoWJlyyefhj0/isnB1xBiY80hgcuvy08Z8MAvG SlgawS8p7WaiAZYP51fXAVNXSJGD2oRnG8nwAbJ/4oiVBAymvJbmnPXOv1xRVVhE7uzY Rr9wOdZiIE5f3Soz2sgvQA4amWr2TVKYLwUUNPWzuN6XEZ5Cn7eEAbJnlbmyLj1hpxm6 p1yg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n13si1019582pgl.348.2019.04.02.06.45.39; Tue, 02 Apr 2019 06:45:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731927AbfDBNn0 (ORCPT + 99 others); Tue, 2 Apr 2019 09:43:26 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:43640 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731515AbfDBNkL (ORCPT ); Tue, 2 Apr 2019 09:40:11 -0400 Received: from [167.98.27.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hBJe0-0002ol-J5; Tue, 02 Apr 2019 14:40:04 +0100 Received: from ben by deadeye with local (Exim 4.92) (envelope-from ) id 1hBJdx-0004w0-8h; Tue, 02 Apr 2019 14:40:01 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, Denis Kirjanov , "Peter Rosin" , "Tomi Valkeinen" , "Geert Uytterhoeven" , "Geoff Levand" , "James Simmons" , "Bartlomiej Zolnierkiewicz" , "Fabian Frederick" Date: Tue, 02 Apr 2019 14:38:27 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) X-Patchwork-Hint: ignore Subject: [PATCH 3.16 69/99] fbdev: fbmem: behave better with small rotated displays and many CPUs In-Reply-To: X-SA-Exim-Connect-IP: 167.98.27.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.65-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Peter Rosin commit f75df8d4b4fabfad7e3cba2debfad12741c6fde7 upstream. Blitting an image with "negative" offsets is not working since there is no clipping. It hopefully just crashes. For the bootup logo, there is protection so that blitting does not happen as the image is drawn further and further to the right (ROTATE_UR) or further and further down (ROTATE_CW). There is however no protection when drawing in the opposite directions (ROTATE_UD and ROTATE_CCW). Add back this protection. The regression is 20-odd years old but the mindless warning-killing mentality displayed in commit 34bdb666f4b2 ("fbdev: fbmem: remove positive test on unsigned values") is also to blame, methinks. Fixes: 448d479747b8 ("fbdev: fb_do_show_logo() updates") Signed-off-by: Peter Rosin Cc: Tomi Valkeinen Cc: Fabian Frederick Cc: Geert Uytterhoeven cc: Geoff Levand Cc: James Simmons Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Ben Hutchings --- drivers/video/fbdev/core/fbmem.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -433,7 +433,9 @@ static void fb_do_show_logo(struct fb_in image->dx += image->width + 8; } } else if (rotate == FB_ROTATE_UD) { - for (x = 0; x < num; x++) { + u32 dx = image->dx; + + for (x = 0; x < num && image->dx <= dx; x++) { info->fbops->fb_imageblit(info, image); image->dx -= image->width + 8; } @@ -445,7 +447,9 @@ static void fb_do_show_logo(struct fb_in image->dy += image->height + 8; } } else if (rotate == FB_ROTATE_CCW) { - for (x = 0; x < num; x++) { + u32 dy = image->dy; + + for (x = 0; x < num && image->dy <= dy; x++) { info->fbops->fb_imageblit(info, image); image->dy -= image->height + 8; }