From patchwork Mon Nov 25 19:48:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gax-c X-Patchwork-Id: 13885206 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 62D73D59D67 for ; Mon, 25 Nov 2024 19:49:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C871C10E717; Mon, 25 Nov 2024 19:49:08 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="cPpVeu7z"; dkim-atps=neutral Received: from mail-qt1-f196.google.com (mail-qt1-f196.google.com [209.85.160.196]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9A04110E717 for ; Mon, 25 Nov 2024 19:49:07 +0000 (UTC) Received: by mail-qt1-f196.google.com with SMTP id d75a77b69052e-46695478d03so8543771cf.1 for ; Mon, 25 Nov 2024 11:49:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732564146; x=1733168946; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=YnQPQy9QUMSA3qSC9VfWBW7KVkhU2YHo+3Vjavlz26Y=; b=cPpVeu7zkgaDTP8+58GgHcGsrxuUhkNP3lb3gOheb0vJRuDDNb49Gu5b6lR0JTwbg7 16Mtgxl4sGynYCVJElMr8uFM1GxpG2nON8DB7O5kwPAYCoqq4COEdcfG7X8q4MUA85Cx wmidCfLjCyBROHq+xfwdzEjxKhhtetDixhhAk3eQehVAqHDZI2zrcAZR9okbttfx02ml LiGYjhI8f2y+KjCJjkDj4V9SOF9oC1vxXkSXYyum4UBuufqZU6trjjjr067r5lwdbj+f LIxJvmDBPTeG+S9biW5m/Kez8/JvB6mlIMFQuCou7APqH0RDSEUCl9ZMbU1NkkEc1OV7 4Dsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732564146; x=1733168946; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=YnQPQy9QUMSA3qSC9VfWBW7KVkhU2YHo+3Vjavlz26Y=; b=RXWGVtBsokSIaUAZKv94ER0zGCVaLf5f1pjE3G68gdANdv5D0HdyDhZ8RWG/CApBNH k3kuwRRYKjDKBHY+WQg/lQsoy6Zdueomkgzix9b45YNIdgIvyly/oI9QfR4ZIf/4cTfP CXLQ+D4XUvT3Z4yUzvjg8kl8D4oHg/PJDGv0YYmNa/Ryj0rr2pjG4XxccWWVkFUIOURO htmNcpiTBmv5DHms7q4Tbvy4coTs50VAxoNBmAjWA37gwPhJ3T+dydk1SPSUPev2tQ7i 0AOj9REsK8KCGzZ3/nWJQdeFbbfVbREcW6hQJ8uSoWjvIhOyrvUBnNRBjlckpI0I1oGQ +P0w== X-Gm-Message-State: AOJu0YwFiZ+9SiSumaFOMhg1BwbBCyAtu9zpEbVlvuPTQFHPdY+i9vMm 1c58+TMomOgB0QvuVR49cuLN8hbbEjDKlsKgBl6tXGbDhqgAG0Xw X-Gm-Gg: ASbGncvwwvUg3LCtoxErelIOx/TWnIKpV4VY0ztwfSTkbkaKn22ggTqOdsnE2YauZL0 msDmnS/hdOnzoYBqiOv19pIFQoJM3jyjVDPHylnZpQteWaUI68xFf9eavsY6Gf3wlWjjopu4ebE 7VdO5WxsyGBfyobuGCLha7ydwbk8Khr0/Y1W5XqXJ34Yh8lyJszGZOTqUrHBIUrtLc1pQSDfR/n HSP/k46RKoqrEImip/yP+AxKwAqQjIF3qaNfDLs4hzb+9uFtfZbKywcC6zfvFzCyyBUTnNNpGJ8 TwakPCw5Dr9izQrqEAEK+gYSu4zkdaW3t8cp X-Google-Smtp-Source: AGHT+IGASnVlZTy8uOIIeLvm0VVgeI8MN7apGYPIXsgonX7l5aN8h7HkmTpP2xqHs+QhD2knS7irSw== X-Received: by 2002:a05:622a:391:b0:461:17e6:2651 with SMTP id d75a77b69052e-4653d525977mr210750511cf.8.1732564146425; Mon, 25 Nov 2024 11:49:06 -0800 (PST) Received: from localhost.localdomain (mobile-130-126-255-54.near.illinois.edu. [130.126.255.54]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4653c3dc08dsm49025411cf.3.2024.11.25.11.49.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Nov 2024 11:49:05 -0800 (PST) From: Gax-c To: oleksandr_andrushchenko@epam.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com Cc: dri-devel@lists.freedesktop.org, xen-devel@lists.xenproject.org, Zichen Xie Subject: [PATCH] drm/xen-front: cast calculation to __u64 in xen_drm_drv_dumb_create() Date: Mon, 25 Nov 2024 13:48:51 -0600 Message-Id: <20241125194850.14274-1-zichenxie0106@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Zichen Xie Like commit b0b0d811eac6 ("drm/mediatek: Fix coverity issue with unintentional integer overflow"), directly multiply args->pitch and args->height may lead to integer overflow. Add a cast to avoid it. Signed-off-by: Zichen Xie --- drivers/gpu/drm/xen/xen_drm_front.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/xen/xen_drm_front.c b/drivers/gpu/drm/xen/xen_drm_front.c index aab79c5e34c2..639aad26f6c9 100644 --- a/drivers/gpu/drm/xen/xen_drm_front.c +++ b/drivers/gpu/drm/xen/xen_drm_front.c @@ -415,7 +415,7 @@ static int xen_drm_drv_dumb_create(struct drm_file *filp, * For details also see drm_gem_handle_create */ args->pitch = DIV_ROUND_UP(args->width * args->bpp, 8); - args->size = args->pitch * args->height; + args->size = (__u64)args->pitch * args->height; obj = xen_drm_front_gem_create(dev, args->size); if (IS_ERR(obj)) {