From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.groups.io with SMTP id smtpd.web09.10727.1582302159756931289 for ; Fri, 21 Feb 2020 08:22:39 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=W8ccbHA2; spf=pass (domain: redhat.com, ip: 207.211.31.81, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582302158; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M1ZU0+h8rltlv/rFU7l5P8R4MVJS8grYSmK6qkHffo8=; b=W8ccbHA2QBJMob6s0k2GI7JjARM9DOr4BeEY4nePantuKQFK4rT8lXaOHOidScODEak4l6 sZY5BiNh0FJQPAeHn4jV2KbVqXWv50u/F4G6iV9iDYSUWmarIHabr7Hqus02W5pceo+PQq 8J/G+xkCHpLQnE3T83Suy7z6BcTwcw4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-19-sswkZtEaPHiUS5c7Jz0a_g-1; Fri, 21 Feb 2020 11:22:30 -0500 X-MC-Unique: sswkZtEaPHiUS5c7Jz0a_g-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AF8351005510; Fri, 21 Feb 2020 16:22:29 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (unknown [10.36.118.95]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1474060BE0; Fri, 21 Feb 2020 16:22:28 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/Bus: Potential NULL pointer on Token To: devel@edk2.groups.io, newexplorerj@gmail.com References: <4ed94d8e2d027528621074754169fbcb9bea0a22.1582261089.git.newexplorerj@gmail.com> From: "Laszlo Ersek" Message-ID: <26c33efe-faf7-8f66-1842-450c5b3ad6a4@redhat.com> Date: Fri, 21 Feb 2020 17:22:28 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <4ed94d8e2d027528621074754169fbcb9bea0a22.1582261089.git.newexplorerj@gmail.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit On 02/21/20 07:00, GuoMinJ wrote: > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2286 > > Token pointer may be NULL, it is should be check before use it. > > Signed-off-by: GuoMinJ > --- > MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c b/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c > index 9f42abe7e2..25ab5abb2d 100644 > --- a/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c > +++ b/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c > @@ -1367,7 +1367,12 @@ SdEraseBlocks ( > return Status; > } > > - DEBUG ((EFI_D_ERROR, "SdEraseBlocks(): Lba 0x%x BlkNo 0x%x Event %p with %r\n", Lba, BlockNum, Token->Event, Status)); > + DEBUG ((DEBUG_ERROR, "SdEraseBlocks(): Lba 0x%x BlkNo 0x%x with %r, ", Lba, BlockNum, Status)); > + if ((Token != NULL) && (Token->Event != NULL)) { > + DEBUG ((DEBUG_ERROR, "Event pointer is %p\n", Token->Event)); > + else { > + DEBUG ((DEBUG_ERROR, "Event is meaningless\n")); > + } > > return Status; > } > Please update the subject line; it should say "SdDxe" somewhere. Thanks Laszlo