From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.24; helo=mga09.intel.com; envelope-from=hao.a.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9D0FD21191754 for ; Sun, 18 Nov 2018 17:11:44 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Nov 2018 17:11:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,250,1539673200"; d="scan'208";a="109360687" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga001.jf.intel.com with ESMTP; 18 Nov 2018 17:11:44 -0800 Received: from fmsmsx114.amr.corp.intel.com (10.18.116.8) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 18 Nov 2018 17:11:43 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX114.amr.corp.intel.com (10.18.116.8) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 18 Nov 2018 17:11:43 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.117]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.214]) with mapi id 14.03.0415.000; Mon, 19 Nov 2018 09:11:41 +0800 From: "Wu, Hao A" To: Jeff Brasen , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [PATCH v2] MdeModulePkg/SdDxe: Fix potential NULL pointer access Thread-Index: AQHUfYPVyyTQdPgRIEe80RL2v4yr2aVWTliA Date: Mon, 19 Nov 2018 01:11:40 +0000 Message-ID: References: <554d7bd5193cec18f844e31a9dd598b3c6c7dae2.1542355760.git.jbrasen@nvidia.com> In-Reply-To: <554d7bd5193cec18f844e31a9dd598b3c6c7dae2.1542355760.git.jbrasen@nvidia.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v2] MdeModulePkg/SdDxe: Fix potential NULL pointer access X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Nov 2018 01:11:44 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Je= ff > Brasen > Sent: Friday, November 16, 2018 4:10 PM > To: edk2-devel@lists.01.org > Cc: Jeff Brasen > Subject: [edk2] [PATCH v2] MdeModulePkg/SdDxe: Fix potential NULL pointer > access >=20 > SdReadWrite can be called with a NULL Token for synchronous operations. > Add guard for DEBUG print to only print event pointer with Token is not > NULL. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Jeff Brasen Thanks. Reviewed-by: Hao Wu and pushed at 5a16ba3ae18e6528cb83039951e15a4b76004949 Best Regards, Hao Wu > --- > MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) >=20 > diff --git a/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c > b/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c > index b8d115a..a4695ff 100644 > --- a/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c > +++ b/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c > @@ -670,8 +670,9 @@ SdReadWrite ( > if (EFI_ERROR (Status)) { > return Status; > } > - DEBUG ((DEBUG_BLKIO, "Sd%a(): Lba 0x%x BlkNo 0x%x Event %p with %r\n= ", > IsRead ? "Read" : "Write", Lba, BlockNum, Token->Event, Status)); > - > + DEBUG ((DEBUG_BLKIO, "Sd%a(): Lba 0x%x BlkNo 0x%x Event %p > with %r\n", > + IsRead ? "Read" : "Write", Lba, BlockNum, > + (Token !=3D NULL) ? Token->Event : NULL, Status)); > Lba +=3D BlockNum; > Buffer =3D (UINT8*)Buffer + BufferSize; > Remaining -=3D BlockNum; > -- > 2.7.4 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel