Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3635295imu; Mon, 28 Jan 2019 08:11:43 -0800 (PST) X-Google-Smtp-Source: ALg8bN5QqhH3eV3kRi8yyOM3Qk55cyj5mW5MXmCACEuYBJoRFks3+G958yq5vTAGiGne9f/th4/1 X-Received: by 2002:a63:ed42:: with SMTP id m2mr20448651pgk.147.1548691903421; Mon, 28 Jan 2019 08:11:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548691903; cv=none; d=google.com; s=arc-20160816; b=JbYIJ9u1Y74YmfPEtYSSs6zLlWG3xlOitVtug5Qy0Cx2Rc24QH8wdrnGdzGEYuKdJt bVdxy9+2k/jZlbwibYwJeUAPxv6ZIKMzO1tHeN6Le1ECNMjYnQNgcg9PjxN1snSy2eVs QsCOT+DRGJFy6DCrYfqh7uR3eZF8wSL8zVpFcUXmUefyUCOCBx1Iu+xtyPDr/gV1Q4ys xczfK6i6W9hQVfHk1742bcwm1i6dxAjbLDOGzGULI4u45ow8MWE2nhOnKMdS4yyNFBLZ nfuboFITnxKnhKd+qllIF235Mm0ScIrzJWAkIBZCDHI/+FfROBOrGj09fOfHoQ00pGPR CGGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+Az9oCWj1QuBtBjynFZ3k0bd5d3D/dnSTq891ZYo73k=; b=kUIoyzui87W1tlrP70e1G3/4ZUM8Ae2/wIudehtMB7VheO7XOOSvPkRbPAWWdhxDqF pyXoqkMktwCiK43pj2EmAoNSZZ/0E1vC2PW3qEiD3PwSdx+Orw4C4Gho/2oyLbVGnHIy WRhklP/uQ+CsnQSf/rVSPBdiRMWhIYzEa/WLsiW3qHXzJO4NP37En5LI8AagwgDfQuDt bXgwk7tRKGanNiCuSVT0rWHQ1ydxxYoYhJ2KDUG8ApavmdJGNd8rWK0UMKzhGlAdjiqk Z8mSE3G3y4OxH34D8z1c3e6T5do8qQxCrhM68Jq0u2fvOn8L/K7PyfYa1dCxGdsM0Mhs I2Ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ALpVL5Vs; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r6si33228287pli.248.2019.01.28.08.11.28; Mon, 28 Jan 2019 08:11:43 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=ALpVL5Vs; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732571AbfA1QJS (ORCPT + 99 others); Mon, 28 Jan 2019 11:09:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:33724 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731921AbfA1QJQ (ORCPT ); Mon, 28 Jan 2019 11:09:16 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 093052084A; Mon, 28 Jan 2019 16:09:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691755; bh=jrgicIxtqRkL1KtmtBG4JOfwGWvvas/2GbuFU5Q90XM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ALpVL5Vs8lDTwmH08h2r0iOyRtrHUZ6MFWhvntB4Y4oke3xjTVzwKmtMTp2ZFAH0i r7URv6bnPB0Tvu7JDjCPaacJ1aB7fGXSleOMpRIm75A5ScUcvFJKWRqYR2DSla+j0Z cbc3uw2iiW+rOa5RK3GjxqNWvZ9rY/X1HhIYGB2o= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Peter Rosin , Tomi Valkeinen , Fabian Frederick , Geert Uytterhoeven , Geoff Levand , James Simmons , Bartlomiej Zolnierkiewicz , Sasha Levin , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 206/258] fbdev: fbmem: behave better with small rotated displays and many CPUs Date: Mon, 28 Jan 2019 10:58:32 -0500 Message-Id: <20190128155924.51521-206-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peter Rosin [ Upstream commit f75df8d4b4fabfad7e3cba2debfad12741c6fde7 ] 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: Sasha Levin --- drivers/video/fbdev/core/fbmem.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 20405421a5ed..77cee99fc36c 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -435,7 +435,9 @@ static void fb_do_show_logo(struct fb_info *info, struct fb_image *image, 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; } @@ -447,7 +449,9 @@ static void fb_do_show_logo(struct fb_info *info, struct fb_image *image, 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; } -- 2.19.1