Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2178781iof; Tue, 7 Jun 2022 22:19:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMlJJg8iHdBQebWCtzByo2nPUxn8YvTp4ictxn1VneXf7tWaQHuKRKczqSIL/4K6kQgfaf X-Received: by 2002:a05:6a00:2148:b0:4fa:92f2:bae3 with SMTP id o8-20020a056a00214800b004fa92f2bae3mr32993274pfk.69.1654665592936; Tue, 07 Jun 2022 22:19:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654665592; cv=none; d=google.com; s=arc-20160816; b=dc1Voe2m4XR21CD6r1pZ4VLkFnG1vPo+ytAbPCGTonTQMDw2AarrAMEGFDPNIo5c08 uZGHE+awlimxKnwg9/5sTwzd+CPeXrO+qPdq2yYnJJM1TcwYrPzIx2ifefcZz7Ah/NvV yJ2w60P3Ga2WmLMjcM6JSnqsuFu87wrLUr1+/ArG6FRVtNv4e/b8g9vWLQAMvIhCBaIa RAIGTCni9pOsPH2q0CWl0/5NOVrglbw+FxHiVVX0F34sXi/vUI3lnnCgUJOtWF4dpHTf 1StqmTQRrJCXBROoZ/zRGvfR3YV4NFBACFzUUO3NdcQhnOlsx+NbFkgHsey4YNHI+u7C Fmdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=riYxWgnfyEpcIgAiDw0L5BFc6QRBMqAyo9RFEVz4Ltg=; b=NEhrgrox5FQZu+IlYlN/tbqfgU8h2oWU7VYlZeJA4uZ/PNewUHcvRyKTioHZlC0LYm 5+nNur9G/M8jEe1Wmro4cOuRMTPfmAueNYOOMeB+PK/wSzGhRRr7URSF9Qs9hIdkr7o1 KLcgRaJoBrIC8x1t0wTiWnDgguwI+1UNMcNRxAzkF0OpVoo3kzExXy4a3Qk9RZ4YiDqn 3xes+dqUdYP9gMJ8+erIwXgOWWFK9VR0Cs4KBWZBWkXfOmp4vkoF7Qy/Ddh/pIOh4is/ XQ8jS9Bm3chOPIBngOWQ+4HDqBwi5fIMSFve82CNiblkSLuAtB8HkvDj17W8CfwXKm7i Gl/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=XBkzcn57; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q199-20020a632ad0000000b003fca85f8c05si24989813pgq.487.2022.06.07.22.19.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:19:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=XBkzcn57; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AEFFC2462ED; Tue, 7 Jun 2022 21:48:29 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377904AbiFGVYL (ORCPT + 99 others); Tue, 7 Jun 2022 17:24:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377049AbiFGU2W (ORCPT ); Tue, 7 Jun 2022 16:28:22 -0400 Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4F481DAE53 for ; Tue, 7 Jun 2022 11:33:47 -0700 (PDT) Received: by mail-ot1-x32c.google.com with SMTP id 61-20020a9d0bc3000000b0060b9bfcfe76so13475362oth.9 for ; Tue, 07 Jun 2022 11:33:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=riYxWgnfyEpcIgAiDw0L5BFc6QRBMqAyo9RFEVz4Ltg=; b=XBkzcn57gKjDBu71hUDF7cAVJFALVJI4Nv/Ffo3O1uQTQ2qw8JOcs/hc4yUu1NHNCp +KgXAx7OYD6YxbzeZPvOozEqWsVq4hSzGeh3c/xROn+dyTt8DboZkCw/Tl+RdhY6OEAu iX4P2GFeZ0wH6Iz5JajX+2AbV6wdBs5eqCa1Bh0/vGpZlUO0C328blVHX9R6iQUOi2co FT58XcbsAP3L3EfnAg3UOvZT9e5p4dfMHJMekbq1peYgPGsbMsGw8uBfHFskrXtrc2Um i0j85cQnTjMaDHcg5FH6wBHKFitjvV95aXQj81nT/B3ysWsJ6ujEayv7pAdT1Y8Y8JP/ Vnhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=riYxWgnfyEpcIgAiDw0L5BFc6QRBMqAyo9RFEVz4Ltg=; b=LRDwF2CmjzHcoIew6zCgaT3tVnRozzVa5+RjfBMRWkw1WbX6fOzBLmJcAyZlmv4O0g hAW5CgQcz3Ai5YTJmlGh6Pd/s9wf9aAcO+5RtWgZE7aQhFLJuqz9DDqCQTLfsPtSbX99 uao9/f26KG2TwSkTKb9F51eaJA9jkdiYCrVXw3Fn53VC6A9G8m5K6G691vAy9LCBYB7K sVp4qw1rITI1/ffEsHzMC16C4nsL78T+D9cHBzZKId7WwnJY3cVD+1BSGiYET3KEJNGx aTQ5DphyD0hVVs25kENuAI/OG0QOGkiBjM7KHepXBJ6ZLnj8O0gk8BnD0qZPuGpL9qj3 8Q2w== X-Gm-Message-State: AOAM533WyOis7Z9dQMnE2shOy1CofxGrP13LzzpIfCUsRkkhXVjURBlq IakAllXOalniNHtTtUNb+TgoNZ8J2l6vJyq5c7I= X-Received: by 2002:a9d:5f9c:0:b0:60b:f3e3:4658 with SMTP id g28-20020a9d5f9c000000b0060bf3e34658mr6776825oti.200.1654626826726; Tue, 07 Jun 2022 11:33:46 -0700 (PDT) MIME-Version: 1.0 References: <20220607153631.7885-1-xiaohuizhang@ruc.edu.cn> In-Reply-To: <20220607153631.7885-1-xiaohuizhang@ruc.edu.cn> From: Alex Deucher Date: Tue, 7 Jun 2022 14:33:35 -0400 Message-ID: Subject: Re: [PATCH 1/1] drm/radeon: integer overflow in radeon_mode_dumb_create() To: Xiaohui Zhang Cc: Alex Deucher , Christian Koenig , xinhui pan , David Airlie , Daniel Vetter , amd-gfx list , Maling list - DRI developers , LKML Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Applied. Thanks! Alex On Tue, Jun 7, 2022 at 12:05 PM Xiaohui Zhang wrote: > > Similar to the handling of amdgpu_mode_dumb_create in commit 54ef0b5461c0 > ("drm/amdgpu: integer overflow in amdgpu_mode_dumb_create()"), > we thought a patch might be needed here as well. > > args->size is a u64. arg->pitch and args->height are u32. The > multiplication will overflow instead of using the high 32 bits as > intended. > > Signed-off-by: Xiaohui Zhang > --- > drivers/gpu/drm/radeon/radeon_gem.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c > index 8c01a7f0e027..84843b3b3aef 100644 > --- a/drivers/gpu/drm/radeon/radeon_gem.c > +++ b/drivers/gpu/drm/radeon/radeon_gem.c > @@ -833,7 +833,7 @@ int radeon_mode_dumb_create(struct drm_file *file_priv, > > args->pitch = radeon_align_pitch(rdev, args->width, > DIV_ROUND_UP(args->bpp, 8), 0); > - args->size = args->pitch * args->height; > + args->size = (u64)args->pitch * args->height; > args->size = ALIGN(args->size, PAGE_SIZE); > > r = radeon_gem_object_create(rdev, args->size, 0, > -- > 2.17.1 >