Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751983AbdIUHyu (ORCPT ); Thu, 21 Sep 2017 03:54:50 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:38084 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751899AbdIUHyT (ORCPT ); Thu, 21 Sep 2017 03:54:19 -0400 X-Google-Smtp-Source: AOwi7QBlWGWvXrxS1eYhxHoOwLzYyzdmHMUPo5qXXfdpuaI3Oa+weW92RnlCvlxwBoVxNxfcfJt3bg== From: Arvind Yadav To: mchehab@kernel.org, bp@alien8.de, tony.luck@intel.com Cc: linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] EDAC: sb_edac: Handle return value of kasprintf Date: Thu, 21 Sep 2017 13:23:12 +0530 Message-Id: <1505980393-20307-3-git-send-email-arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1505980393-20307-1-git-send-email-arvind.yadav.cs@gmail.com> References: <1505980393-20307-1-git-send-email-arvind.yadav.cs@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 667 Lines: 24 kasprintf() can fail here and we must check its return value. Signed-off-by: Arvind Yadav --- drivers/edac/sb_edac.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c index dc05916..2b9e831 100644 --- a/drivers/edac/sb_edac.c +++ b/drivers/edac/sb_edac.c @@ -3286,6 +3286,10 @@ static int sbridge_register_mci(struct sbridge_dev *sbridge_dev, enum type type) pvt->sbridge_dev->source_id, pvt->sbridge_dev->dom); break; } + if (!mci->ctl_name) { + rc = -ENOMEM; + goto fail0; + } /* Get dimm basic config and the memory layout */ rc = get_dimm_config(mci); -- 1.9.1