Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp2996189rdh; Mon, 27 Nov 2023 04:24:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IGSCbRLr5LdeD6G3ZT3l0X2RZwCLhPPZtVHRNvESJe1UNYL4cuyjNbuhfH5A5HT5FNp/HgN X-Received: by 2002:a92:cd88:0:b0:359:d1c4:b454 with SMTP id r8-20020a92cd88000000b00359d1c4b454mr14668104ilb.20.1701087873000; Mon, 27 Nov 2023 04:24:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701087872; cv=none; d=google.com; s=arc-20160816; b=aSCcNW8+5PuLjz225UXsKJsBKqKQIdKKoIdJCKvUp2TGgQUIqXusk/61pnPjtkz5lc ivv4g1dyW5/qnkSxqKpy4bEZUWGL9oMfEqxm/egp0nqv/jZ1O1UuVItT/IlBCsRpQpBh b7NGLcGq60Ilg2FYSpEuUmQCXXJRZIPe8ROBv9gff0w8Fu/18vCSCZjqAjjmGxwsGZ6M Yt4M3PQYPXmfU6YMfXVAqy4NCLGfuJjEtDI/9aDUgeuDkSr7v5Km4uAIH3opLZuB3rGM 33OHO09yWzZGYRjUM2z7cXDIIJnQt+u4JOdgLVGKf7t+cxu51w6BrwiMUvhlizO+UlDF X+qQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=YYDiqW/SQ7zaMFpt/KuBFGN2HjMliY/gtAkoUJNHgw8=; fh=0/jfTfYFJ+DhkcNnUJ10ZGnryglAb9011rRqrzSFNxg=; b=az35jiisfhYl36Ai7mcs0Kl0O5HRIAlM2jn5/s+ptCB3qGFGnuSBcXjuXD/bJ6VS58 m9aPj7BbMXMRwG7hIBybWQTp6SV2v567KAQv4A5ZJ2nwPmhd1qSlrhRgaG3Bcy6zhlWQ S1/weQAl4cDRBdJZ0RbdDynBwg4AkFhdWQB5vvAWm01fW87WX5dwr/Mo/xY5HEC2IJTS 2BYYJydyiT+VnzbceUWTDSg/VYBYOtFQXnvvTEeFwOTCaxkdNymk/NrcOyAwNRRq4+Jk Dau4DPGzmlJ7c3BL3f63/9B8KJD54g1e0vj+5OOtVC1D7+dKupAW6QHpSPJygcjp+muX O/kQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CZTr838E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id n6-20020a634d46000000b005b8f61fcba5si9037505pgl.399.2023.11.27.04.24.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 04:24:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CZTr838E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 6B342807DEEC; Mon, 27 Nov 2023 04:24:30 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233276AbjK0MYP (ORCPT + 99 others); Mon, 27 Nov 2023 07:24:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233210AbjK0MYN (ORCPT ); Mon, 27 Nov 2023 07:24:13 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38EC110F for ; Mon, 27 Nov 2023 04:24:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701087859; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YYDiqW/SQ7zaMFpt/KuBFGN2HjMliY/gtAkoUJNHgw8=; b=CZTr838EVrjV4bq5TxRtHyclYucgJi/nCLLXNpCVUuj2bt+AxYOf+9UIBA/Av6wAtbjZh0 Zy4G0xMQIdJP/yGeL6dFO0QCvoYMhejYSfDuVGoun9qPaE7KlnwvfteYkRN8dCl8mz8sqR WRhm+DpiR4zLD+Xw10ouY5MBR7B7las= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-622-38RhbPKLPnOjzP6V7XGctw-1; Mon, 27 Nov 2023 07:24:17 -0500 X-MC-Unique: 38RhbPKLPnOjzP6V7XGctw-1 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-a0d9009b457so101545066b.2 for ; Mon, 27 Nov 2023 04:24:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701087856; x=1701692656; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=YYDiqW/SQ7zaMFpt/KuBFGN2HjMliY/gtAkoUJNHgw8=; b=n8INQz1NINFNFPuTJL6PjEfvoD8kwblrcnuOJIvv5YYw/OhUv2YktyEvt3JbwE9bBD 2zMZeaGjwtosUVy4DNOjjT99eSUL2FT+2QP2y86DT1+t5mLqsX2E5Wg5onZuRVCEa/Mp gZk0YU/Dl7cW+c68Uhk6556LFn2Pl+lWpTwkAbwoBmUrOX6P8UaePAEwukPHxiojXZXw UQ6Fj6yjfkg3OrK8ZRQjMVqz++s6FsrtP/CVd/AuL2/H41c7Z1+Ox5WM5ZbVex/hBQQ2 7jSmZxeTKarseaQB1uJ2Kt0Sy9MESSu1fnm+xTBtLR3h7APA1vilgdzrAk36JsnNfJbt jp0Q== X-Gm-Message-State: AOJu0Yx5DBvhyB6YAoHLiSlstaz/AzxQUUKu1a4ywLXO6p/8hlQ1KtIf 92LAOkdCABpGIw7XL8Q3xdUOFBCnVktczw/RW+KiBBHfknWJZqMMC6n5xho/C59wFLVT0jeWoZb yEUl/D7yeVCdeNTWRHxJroO4P X-Received: by 2002:a17:906:20de:b0:a01:811c:ce9 with SMTP id c30-20020a17090620de00b00a01811c0ce9mr9178993ejc.0.1701087856570; Mon, 27 Nov 2023 04:24:16 -0800 (PST) X-Received: by 2002:a17:906:20de:b0:a01:811c:ce9 with SMTP id c30-20020a17090620de00b00a01811c0ce9mr9178965ejc.0.1701087856272; Mon, 27 Nov 2023 04:24:16 -0800 (PST) Received: from [10.40.98.142] ([78.108.130.194]) by smtp.gmail.com with ESMTPSA id t27-20020a1709063e5b00b009fd727116b4sm5611223eji.129.2023.11.27.04.24.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Nov 2023 04:24:15 -0800 (PST) Message-ID: <8d66d4c0-ebc2-43b1-98b3-c41c871b4b7e@redhat.com> Date: Mon, 27 Nov 2023 13:24:14 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] platform/mellanox: Add a null pointer check in mlxbf_pmc_create_groups Content-Language: en-US To: Kunwu Chan , ilpo.jarvinen@linux.intel.com, vadimp@nvidia.com, jiri@resnulli.us, shravankr@nvidia.com Cc: kunwu.chan@hotmail.com, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org References: <20231127063433.1549064-1-chentao@kylinos.cn> From: Hans de Goede In-Reply-To: <20231127063433.1549064-1-chentao@kylinos.cn> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Mon, 27 Nov 2023 04:24:30 -0800 (PST) Hi, On 11/27/23 07:34, Kunwu Chan wrote: > devm_kasprintf() returns a pointer to dynamically allocated memory > which can be NULL upon failure. > > Fixes: 1a218d312e65 ("platform/mellanox: mlxbf-pmc: Add Mellanox BlueField PMC driver") > Signed-off-by: Kunwu Chan Thanks, patch looks good to me: Reviewed-by: Hans de Goede Regards, Hans > --- > drivers/platform/mellanox/mlxbf-pmc.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/platform/mellanox/mlxbf-pmc.c b/drivers/platform/mellanox/mlxbf-pmc.c > index 0b427fc24a96..59bbe5e13f6b 100644 > --- a/drivers/platform/mellanox/mlxbf-pmc.c > +++ b/drivers/platform/mellanox/mlxbf-pmc.c > @@ -1882,6 +1882,8 @@ static int mlxbf_pmc_create_groups(struct device *dev, int blk_num) > pmc->block[blk_num].block_attr_grp.attrs = pmc->block[blk_num].block_attr; > pmc->block[blk_num].block_attr_grp.name = devm_kasprintf( > dev, GFP_KERNEL, pmc->block_name[blk_num]); > + if (!pmc->block[blk_num].block_attr_grp.name) > + return -ENOMEM; > pmc->groups[pmc->group_num] = &pmc->block[blk_num].block_attr_grp; > pmc->group_num++; >