Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1089336pxp; Thu, 17 Mar 2022 02:33:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwj6lXWMJy4/WXV0sA29plQTgLuQs2SFNzY694CMe6rKDQNeoTi7EcJG+DVrAaDACy22cgo X-Received: by 2002:a17:906:4cd8:b0:6db:372:c4ba with SMTP id q24-20020a1709064cd800b006db0372c4bamr3473321ejt.57.1647509609669; Thu, 17 Mar 2022 02:33:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647509609; cv=none; d=google.com; s=arc-20160816; b=Ffycq6l7V4CfJLA9bdSUsKCSBvp24ZdFksuRSjEnuXWfVjgWVu1625uk6qz5kCteoW 3AV+96QjA4Bbm+auD9xFSabvQoy1vR6KSwgRxSdc+ijYbQyb87sBpONUvW1UVWadjDkw VTY2ZGvBKLuqX0u92fBRwSE1c9kb/Qkf9M+XwOfGb4OzItMeqN+qzZdLTZloaTpSccYn qcZxxNiPPYccqvFF8/Q84b50205LBXl6A/JNSWKE/qBWPu/efdrugLCre/uxbkieKhnw /oUffDMEB4N++Xsc2QxQnCe5XsULbi13RMDw69gUwUSh6yKW5XOAmpC75waaUfR11qJZ GvzQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=LDb8QStF0jQy9ZmB3XzMdxIOhrPXG+UoQhYRayN3k9c=; b=ozdHl+MnJBGTUiELJYNmBE3Nf6lR6/2RW7EcUKnD7HiDs49Bqpgmt/9dxOQH/wku9I OWasX8mfckHnoHrxuws6eBGpMEco9Po0EnfujA1koy5GdL+wbOCKJETk7vrkUcMNoP8M +ykooutRE3prlLwbm3Y1AO4zXtWPCUDCF0Gf6vTUDsIY/AHaehBCYwWI48W9x6d7hSc/ Ax8PlIN126Yd+/9y1hB7m2WI/FslPodTYs6/Y7d6055bJl1jc4eAQJqdNR7bLcHsKvua qdnd+InXzTFjvMFkkvTYCryD0H2KzeSXutUc5oqx2F/DTW1G9IroXTcbDrTfFtb2B7sF Ctqg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bv9-20020a170906b1c900b006d06e3761c4si2692895ejb.986.2022.03.17.02.33.04; Thu, 17 Mar 2022 02:33:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230455AbiCQIUA (ORCPT + 99 others); Thu, 17 Mar 2022 04:20:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229674AbiCQIT6 (ORCPT ); Thu, 17 Mar 2022 04:19:58 -0400 Received: from albert.telenet-ops.be (albert.telenet-ops.be [IPv6:2a02:1800:110:4::f00:1a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49FD4149647 for ; Thu, 17 Mar 2022 01:18:38 -0700 (PDT) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed40:f500:58f9:d953:424b]) by albert.telenet-ops.be with bizsmtp id 7LJa2700e0M4NNo06LJbff; Thu, 17 Mar 2022 09:18:36 +0100 Received: from rox.of.borg ([192.168.97.57] helo=rox) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1nUlL8-004vCB-BF; Thu, 17 Mar 2022 09:18:34 +0100 Received: from geert by rox with local (Exim 4.93) (envelope-from ) id 1nUlL7-0055A6-CG; Thu, 17 Mar 2022 09:18:33 +0100 From: Geert Uytterhoeven To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Javier Martinez Canillas , =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Cc: Andy Shevchenko , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2 5/5] drm/repaper: Reduce temporary buffer size in repaper_fb_dirty() Date: Thu, 17 Mar 2022 09:18:30 +0100 Message-Id: <20220317081830.1211400-6-geert@linux-m68k.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220317081830.1211400-1-geert@linux-m68k.org> References: <20220317081830.1211400-1-geert@linux-m68k.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As the temporary buffer is no longer used to store 8-bit grayscale data, its size can be reduced to the size needed to store the monochrome bitmap data. Fixes: 24c6bedefbe71de9 ("drm/repaper: Use format helper for xrgb8888 to monochrome conversion") Signed-off-by: Geert Uytterhoeven Reviewed-by: Javier Martinez Canillas --- v2: - Add Reviewed-by. Untested due to lack of hardware. I replaced kmalloc_array() by kmalloc() to match size calculations in other locations in this driver. There is no point in handling a possible multiplication overflow only here. --- drivers/gpu/drm/tiny/repaper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/tiny/repaper.c b/drivers/gpu/drm/tiny/repaper.c index a096fb8b83e99dc8..7738b87f370ad147 100644 --- a/drivers/gpu/drm/tiny/repaper.c +++ b/drivers/gpu/drm/tiny/repaper.c @@ -530,7 +530,7 @@ static int repaper_fb_dirty(struct drm_framebuffer *fb) DRM_DEBUG("Flushing [FB:%d] st=%ums\n", fb->base.id, epd->factored_stage_time); - buf = kmalloc_array(fb->width, fb->height, GFP_KERNEL); + buf = kmalloc(fb->width * fb->height / 8, GFP_KERNEL); if (!buf) { ret = -ENOMEM; goto out_exit; -- 2.25.1