Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp927798lqs; Fri, 14 Jun 2024 09:27:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUwZUmJZSLpm/DsqPzjGvEARhe4HCVpVAaTYMax2/8UW7ZJM81dYOOgRyY/bFAK/J5Ib/7RJRiNyHpGdbSV9gM1UctV/YAndMcphoklsg== X-Google-Smtp-Source: AGHT+IHBX4TA7gPj94KG7jB4zh3KRPM9pc5EA8EmfMnbgAo7sJlpl+gX48b+xEtXiaKd2QRoCoOC X-Received: by 2002:a05:6a20:7284:b0:1b8:5ac6:4bdc with SMTP id adf61e73a8af0-1bae7f01f51mr3624049637.28.1718382442866; Fri, 14 Jun 2024 09:27:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718382442; cv=pass; d=google.com; s=arc-20160816; b=LjJ5/dEip25YQNEY2TpeW/2GbAe/uiYsMdeitGE04pf42OiaiRHaRD5xCbLhJ4FILy lDQJi4iyxSQwEhZybGMymbcvKp+Nt+87l6399phFmFjlchvpnSv0/2k9Vbe6yugFvapW mXV7uMPpY+84J+6gvGyXgKEx8xl8D5wZz5mjxhMhNwoS4C7Jtcwoi4vaS3J4qeYCc60G y4K/ZhKLdOxrQQCqZRplPdlGqUmz5Cc/M01DNtPpLh+5Y2ui1VruQWUriG9vfJUzZdhL b2YSdQpwL/RW3KJaxLJx7mKbsikEUgbKpcPfsUpN5BMedcFq+9/7GRAUfCTRyv5dP8B/ qPdQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=ZLGKDZVOQ3iS6C5OGcazxokC/tYhNiWsWZ8pHrHihu0=; fh=6r0Id2rdulNtXQAbIbazHb4yIkR9c3atE1clbGk7ptQ=; b=kvL6oUY5ivRWxF/5l+HaD/NWq51DYtUzaY7egFmsuE9c0N78aXVQmEL6gKfaGnXkOu +VwIdggHe0iaZl4DyQ1DmDbz0ygs+lmBrFs4DsHh9ijrQnxY0er1ug/xzwG1MgHUR9pe ACJfGNzUgothy8aYAvR9XGsv1x04ac0BR99rolQSNWBZBrE6jRbNRnf2Q64/ZzoZnaoW G7ONVRPv5M26lFT/MYna1i3Lu0PrSqcz2+2gxAZwEItk8CIoDWkWyoHTDm54m3wP9JAw Q96BiadTsJR0VtNMwJ5eAzjOsPZoW1oDHjFBDnD9iA1DgELWs7ywelmFUFObZfBQ5BzF Nr/A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=IF8ldubh; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-215241-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215241-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c4c4706a61si3816783a91.102.2024.06.14.09.27.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 09:27:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-215241-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=IF8ldubh; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-215241-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215241-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id EC02D2849B9 for ; Fri, 14 Jun 2024 16:26:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DC671195FDE; Fri, 14 Jun 2024 16:26:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IF8ldubh" Received: from mail-yw1-f179.google.com (mail-yw1-f179.google.com [209.85.128.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B35C8192B7B; Fri, 14 Jun 2024 16:26:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718382369; cv=none; b=dxG5xxkW1Alhyq9XZJdyEmZ1+Qn6K4xM2WICXZM3u0TzqWmR3RhNTZIQicpPODij0CBI+nPIi1Bef6qi2NJxErXddjv3QpNYFOJUllrSAJ8cZaDl+btTpdGCZI5InIcdMYaJ2a/dft2AHW0nrdbrdeHKmu9xlRbDOkdyFKh2A0Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718382369; c=relaxed/simple; bh=ayg07pF7euQv/CPhXKbrgipzCXGh1+VtDo0vciMqb4c=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=CpjjKeDAEQCJR3PRXSxW7URpujdfb181jfL8138MowLpyXqTP3aM7AW9VwZPZZb4gfc4mflgEtPedtjIN5SltzXfpYkgHVNZNz06BLHXrfzI8mEv9tAyP/bcoKb6aAMK7Gb1x4QcncbzIXjtGF12Xwsr+pclQy/fsq/Dln9370A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=IF8ldubh; arc=none smtp.client-ip=209.85.128.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yw1-f179.google.com with SMTP id 00721157ae682-62a0809f96dso2335067b3.0; Fri, 14 Jun 2024 09:26:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718382366; x=1718987166; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ZLGKDZVOQ3iS6C5OGcazxokC/tYhNiWsWZ8pHrHihu0=; b=IF8ldubhLRsL+WU05KIo0+qJ4h1YtQI8Iix20/BZMpWjCxV0kl35bc6/3ofyPYjP/z Ex2BJrbja8qp1izsYk/eguxZGEotrymgB/vEOtOfeFyEed+9LsPqnAakkjN7PEJHBMXh kolNEy90Y5/K9XXvPl0X+jAgC33AAEBsPt5j2HB+QVF2Pfq7s4UT6kptiWO5OqaqDVrh yI5KxbaGcFNv2OFSsMLZqamZB5avaBuGFKVpoc0azefQpEn80P4rzcJlg4UYvYc+HWfC 9/cWp+0/CjwDO1QgFv2iv5gT5XsKTOaYEfID5a3MrJVxS9ICaX28UO4My/OkAPFif/+v 4LUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718382366; x=1718987166; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ZLGKDZVOQ3iS6C5OGcazxokC/tYhNiWsWZ8pHrHihu0=; b=NVv33R4ER7GV2BqaENcUtFrrzEjrwoHgaj4wF0XMv19/Ds2rDCoU7Y8J6x+tQjU38b ggNE0K9hHA9dQeIa1oiS4Ba0iLYCV7iwwJZFZxwVQaQn7FlJljSSchmD5sO6FgZZHXk1 OkoLUJN7cWxuuRf5mG1P8aEjSgbboschPcDbH+Q3/j3wMzI45eAuj99cVpRfkuw5PUI5 3CSca0o+bh3jouCKrcjyCWInMpRm1AlM8ywWDutfJcyqPuM/GcRbtEKK3qt2LKJaAN+G Yzs91kDB/LYOMymczLI/IHwhty8rOJUv9GWPm13m+LFvZrZviCmCt88f23jprsKSMCdA 3hBA== X-Forwarded-Encrypted: i=1; AJvYcCUxqk9S8khgtMTRnXQN9uYjMrcPIbPsSGHa+lm3szf3PHE0XF5acZ4sMRs+alVjQVeSpFhziXOTR/O6FyWRHoI7nMNKbQ38dfqdanMdsR3tqiioZnzssZrw4AVwVNldx/Mz0hXwKUdzqQ== X-Gm-Message-State: AOJu0YxDkq9MRG6kpbOhvOPo/TEeDpL3x9vD1BqG92ps7Lc73z3SFJQB 6s1Id5YpjYrtsu3tREcBihewFgkjHsY9R+5scvH4fJSX6KbzMp8J98RrXfRxGnSptJaFNWX3xSa xKEhbHXPIxhE/Z7LPfhHdDQ0BnyZZgA== X-Received: by 2002:a25:d64d:0:b0:df7:a3c6:c849 with SMTP id 3f1490d57ef6-dff15526355mr2617298276.4.1718382366653; Fri, 14 Jun 2024 09:26:06 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240614124233.334806-1-qq810974084@gmail.com> In-Reply-To: <20240614124233.334806-1-qq810974084@gmail.com> From: Justin Tee Date: Fri, 14 Jun 2024 09:25:55 -0700 Message-ID: Subject: Re: [PATCH V2 RESEND] scsi: lpfc: Fix a possible null pointer dereference To: Huai-Yuan Liu Cc: Justin Tee , james.smart@broadcom.com, dick.kennedy@broadcom.com, James.Bottomley@hansenpartnership.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Hi Huai-Yuan, > diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c > index b1c9107d3408..94d968a255ff 100644 > --- a/drivers/scsi/lpfc/lpfc_attr.c > +++ b/drivers/scsi/lpfc/lpfc_attr.c > @@ -1904,6 +1904,8 @@ lpfc_xcvr_data_show(struct device *dev, struct device_attribute *attr, > > /* Get transceiver information */ > rdp_context = kmalloc(sizeof(*rdp_context), GFP_KERNEL); > + if (!rdp_context) > + goto out_free_rdp; Understood that kfree(NULL) essentially translates to no-op, but I'd prefer that we return len here instead of goto out_free_rdp because there really is nothing to free if kmalloc failed. Thanks, Justin