Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2687566imj; Mon, 11 Feb 2019 07:03:03 -0800 (PST) X-Google-Smtp-Source: AHgI3IZzD3ZxBSNfLD9HkaMsAIH5Y8/zbo36Tg46CPEWjlH51C4FQuPA/jJ/xE1yd/Yi/UIX+hi6 X-Received: by 2002:a62:520b:: with SMTP id g11mr37601665pfb.53.1549897383520; Mon, 11 Feb 2019 07:03:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549897383; cv=none; d=google.com; s=arc-20160816; b=K/1bEnmXyLmMQMtIwUrYghXWsGFOyis0dKOMehm/lqAjyjYg/wFGzN+F+BDJljl3N/ 2G07HRXqQ6eIxLjoysO79VrS3Q2PXg/03tYUgUe+V3/BXknGGMq7TlvAB5shl1+Zcan8 pDmSkFNwMaILACrZs5c6plqr08aZS1qujUFxFQ5yFT66UiHhIsyGU6KpMCDSYkb7rSg5 ytJUCVNPG6/zNfiy5wkGBSUOeaf2ABffoRJEJN1TbLjWpavKTZzDzxCmuANcQy2da3rW coD/aQS4TEwJlhBfVhmbpfcC4/Q60/aBmjbtmMgm9p9MMp/dMCzMuofJ/PikEX1yK4DC ZezQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6YnnE6YpMQiHruSxwzw2yTSU8tG9vGgKoKcW+o2HwF4=; b=Sd+xM3idv5BsBVKIZBat0xcLQLBV+YbiRMMn4tq+k3VWAIeRD3SYCsAO+7d0nekt+z yn9LxFR5kzrHfIShjkJHEFfA7qmq4wQC9bqpgc34bInFAL7T/d/sw29dlg0AUDcOViS8 HhWtVMHCwXTHVthQEaAuwwURvg7G7QSUSbM4jVFkdZ5E6/YszeOTbeEkZ5jGOnsH0glp 0gAiTNXPKOZ8YoUOWg8krEEGN8gWt10NHgexbxvt/s8KEgYx2HxWyrMsL/HE0KJleJGA U2wi2BnagBxWN1kOL0GMlSzx8KyCWW+bX08eixT0jXsn3p58IT13uU2qWdpjAykwqUYR NZGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=R9OpQwz8; 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 b2si6710999pfm.26.2019.02.11.07.02.36; Mon, 11 Feb 2019 07:03:03 -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=R9OpQwz8; 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 S2390236AbfBKPBk (ORCPT + 99 others); Mon, 11 Feb 2019 10:01:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:49700 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389696AbfBKPBj (ORCPT ); Mon, 11 Feb 2019 10:01:39 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 4BD67222A6; Mon, 11 Feb 2019 15:01:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549897298; bh=fQusaHDyd9MI+0/xPYA1XmlAlDbtrorkRVNUkOfo39E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R9OpQwz8shzWhXzZhtUYt0i976tpBAHiizgA2FFQMW0KTf1pNsEuab26y7ySJoCIJ k1OXBnXtxTE0ArshgRNVBN5i5TtI5ntLHcV2XnSekRMtpoqZEBA2XTPT8I/Pq2MTzl tv0AeDyNwYZPw9X6YC9Cnf2ZEGqsoCwM8tlyTgzw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Rosin , Tomi Valkeinen , Fabian Frederick , Geert Uytterhoeven , Geoff Levand , James Simmons , Bartlomiej Zolnierkiewicz , Sasha Levin Subject: [PATCH 4.14 124/205] fbdev: fbmem: behave better with small rotated displays and many CPUs Date: Mon, 11 Feb 2019 15:18:42 +0100 Message-Id: <20190211141836.590898960@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ [ 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 11d73b5fc885..302cce7185e3 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