Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752729AbeABOeH (ORCPT + 1 other); Tue, 2 Jan 2018 09:34:07 -0500 Received: from mail-bl2nam02on0052.outbound.protection.outlook.com ([104.47.38.52]:48727 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752655AbeABOeF (ORCPT ); Tue, 2 Jan 2018 09:34:05 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Christian.Koenig@amd.com; Subject: Re: [PATCH v3] drm/ttm: check the return value of kzalloc To: Xiongwei Song , Hongbo.He@amd.com, airlied@linux.ie Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20180102132455.5413-1-sxwjean@gmail.com> From: =?UTF-8?Q?Christian_K=c3=b6nig?= Message-ID: <89ed14e3-a570-4b4c-07d5-81cf5040e8d6@amd.com> Date: Tue, 2 Jan 2018 15:33:51 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20180102132455.5413-1-sxwjean@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Originating-IP: [2a02:908:1251:8fc0:4c6d:7233:b7e1:3b88] X-ClientProxiedBy: DB6PR0402CA0008.eurprd04.prod.outlook.com (10.172.243.146) To CY4PR12MB1304.namprd12.prod.outlook.com (10.168.168.141) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d8191bc7-ed95-4072-869b-08d551eddf48 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060);SRVR:CY4PR12MB1304; X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1304;3:sAn5A8zQNojjQJXpMHLuU9N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1BAKAn0vr6IVqMcQf+M3FaXOB+OanejtymO6JQLQ0NQV6tSjBM/f2Lsr/gof33xhYHcpBhEjBmBAdQ9DrjJxC/UQO/jM2rlI59iMCIyeV2IAH/0+IEZdHIG8zXthKP6hMnTkb6M3L2QPjcT6wgXDF852d7BoZLVvH6uxTYCUOTFbqZiZVRWbW5sQUPWohQ5hfXHjV0Vqh7smVRa0450yBMX4crzSs31o/nOAoZveCLW0FfdApFdfBEyr0yF/oebzBvtUYvq2wELIC/+ga+k7gH2S3dAAmgofnAzNzO/sGSpWNOIZtJRnxs;4:U3q4m4TnkGsQSzXrIBTB7MT3IkbUMbIlsMIFRQ4NhbefEb1yfoDRT/U+R0yMCH0jEnmaRKUwEW0ctyyphYaBhWN2P2m4/uN1q/0c8Lm8wOXKjKWQR91b5h1Me+lg68Wu78bnksBMK0IHNlJRqGHlOdbJuC2l/4cLtvcd7yFfBUTNavnc3gQgTT1LQcxbM9c895UM6jtmnCVDHe6fspeylrD1Q9uwmmIJcnp2ZLRv5n8prH33pVxiPnBH6srXpou1VNdAYmPmQB7aVWbPYClbELQVo0Qjls/uWS71/RI/PSEQsyVB0cEHgg8/1rWnAdZg X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040470)(2401047)(8121501046)(5005006)(3231023)(944501075)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041268)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(6072148)(201708071742011);SRVR:CY4PR12MB1304;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:CY4PR12MB1304; X-Forefront-PRVS: 0540846A1D X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(39860400002)(346002)(366004)(39380400002)(396003)(376002)(189003)(199004)(6486002)(31686004)(68736007)(52396003)(52116002)(23676004)(2486003)(52146003)(59450400001)(386003)(105586002)(2906002)(36756003)(2870700001)(83506002)(76176011)(67846002)(8936002)(81166006)(6116002)(1706002)(65826007)(8676002)(5660300001)(81156014)(65806001)(65956001)(47776003)(478600001)(106356001)(72206003)(2950100002)(7736002)(6666003)(305945005)(229853002)(4326008)(31696002)(64126003)(58126008)(86362001)(39060400002)(97736004)(25786009)(6246003)(53936002)(50466002)(316002);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR12MB1304;H:[IPv6:2a02:908:1251:8fc0:4c6d:7233:b7e1:3b88];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjEyTUIxMzA0OzIzOmhiajBTRitEWmRsZ0RsNUVZZkJyNU00ckRr?= =?utf-8?B?YU1pb1JQTWttYThlUzUzU3hsd0k3cHRCYWJwaGZ5R0F3WGYvNCtrRXdVdVMr?= =?utf-8?B?enZ3YU5EYjBZc21hMWlYQnZib0dHNVovRFhsbmNxTjl6WlgxTGl3QUxNQk11?= =?utf-8?B?SzhvRlVzamZFOGJ2MVphS2RaYTdBOFR4b1IvUVdVaytab2lpZlNFb00wMkx3?= =?utf-8?B?MDE0Y3o3SEp0cmMxQkF4UFdMWW9Fc3BrU0ltMjdIRFlONnR4cmZSR1FFVjF2?= =?utf-8?B?RWk3dTUrb3hpMUh2TDBFU1BGN0ROYVpHRW05T3hUUE1hTlBLQzh6TEtRclNJ?= =?utf-8?B?dkNsWjRSeTJ6a0ZWV2FOSkoyZXkrdXpnWi90VGVkdWxIdyt4b0FtYjIvTy9h?= =?utf-8?B?TFIwQTE5TGFMbXVEQ2dSWERMd044b1BFK0JRS3ZiNmdLT0hieWFnaHhpbGht?= =?utf-8?B?T3JvRjVzd1hweEtRZUtUVjkvbFNXSkd6QVR3dDdCNy9XcFZwTkNaUlNXRUFK?= =?utf-8?B?MWhySC9oSExlWXh0WWg0dko0N2lOKzZHM2NONm00Nk1aU245UEdLOUJnS1Nr?= =?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0N/w1B+tZsZaI5dqEswRBfQwPo5QGKJG5k8y9/NXV9DsVJ9M+TuE6rnlrehfGsGaVLhaI7j5MrIWsEqrS7nypX+MOuVBa1dwQ2wGe/wO8O1D8Eh8aBLET4U0VrRo+J1BOW8KlCNNllVwlhx/kX1euvJhaUdO3NOlTofI9ng+lsdX8DEHrgWSD8RU0DOs7mDvtVvdt3zK60XZT88ssFJhKaHiKkxqlVn/FRkr SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1304;20:245vlr5JWmHelrVB9AfkxsEcwXGt9WRBY/x3YSS2Z9yXFNQvVQtKN6DpLnpYEfz6gb0hlirU6RJvsn8C+d14FClXVwPj8ompRVZzcJYquCXUdF1+nSUTQMeafuf1KBhTba0CUT1GwZCeAlxXYzsnLgvIC10GTQgBYQRiGloku43G511BBBMarl/eh7ScyWDHM1F6z6EmUpUxQ/UYpUMBdkYg7yxAOxiTdzWgR1wIQrNF7zuGjZJvbsLa8bbGlbjM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jan 2018 14:34:02.2404 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d8191bc7-ed95-4072-869b-08d551eddf48 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1304 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Am 02.01.2018 um 14:24 schrieb Xiongwei Song: > In the function ttm_page_alloc_init, kzalloc call is made for variable > _manager, we need to check its return value, it may return NULL. > > Signed-off-by: Xiongwei Song Reviewed-by: Christian König Going to pick that up for the next release. Thanks, Christian. > --- > v2->v3: delete goto expression > v1->v2: delete kfree _manager > --- > drivers/gpu/drm/ttm/ttm_page_alloc.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c > index b5ba6441489f..5d252fb27a82 100644 > --- a/drivers/gpu/drm/ttm/ttm_page_alloc.c > +++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c > @@ -1007,6 +1007,8 @@ int ttm_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages) > pr_info("Initializing pool allocator\n"); > > _manager = kzalloc(sizeof(*_manager), GFP_KERNEL); > + if (!_manager) > + return -ENOMEM; > > ttm_page_pool_init_locked(&_manager->wc_pool, GFP_HIGHUSER, "wc", 0); >