From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by mx.groups.io with SMTP id smtpd.web12.9039.1583315056134891152 for ; Wed, 04 Mar 2020 01:44:16 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20161025 header.b=V7BFjmIO; spf=pass (domain: gmail.com, ip: 209.85.214.176, mailfrom: newexplorerj@gmail.com) Received: by mail-pl1-f176.google.com with SMTP id j20so380413pll.6 for ; Wed, 04 Mar 2020 01:44:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=QBFwp5tymEJTAbTMW06by1Z+1iLxEf17mQo/mSeBkHM=; b=V7BFjmIO7irppKD3HKFWxMKkGCQDnI3rKllrEVjt4Stmu9vYgFjecAsAQWnm2mbQJA K1DXbwrUqwNbJpnMP5BizxpmK9g0WxW3I7Z4USY5B65nwMonMTBw7iGx283g/TOAv8UR j7Uy+GZrNPoNUH/yTX+B9HU+42sFp5RHcjrlXDnHnGaJJpJimhiptqtVPRKQcoSlwTea CH1zoqLPNQPda8r954Q4RgNDNsxBmDVWovIZAnXJaWsbTlzN6lsoLD7wJ+Q5gt1sHmEb H66+SAwVFUVyos+BzsyePT5FJ6rMxwZlEnmrmNw5GjSzdmc3b9UkINcF80gdQJ5w5deR lTqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=QBFwp5tymEJTAbTMW06by1Z+1iLxEf17mQo/mSeBkHM=; b=un5BRi2fJ67dmTMlyXdfq+/UzAMMJRcgZW83KI8vEKzQtekRWsVBod7fMV474JJNHN yNlF5V1VHH3eYDtLMLRaa17orNsz4cVy50d5ldObQPpxOcMrLF3qDTRdIc//URLFd2Xr mlPSXf5AyKSKUk1M3PyCdlEtF/qtv1/EaMLgI1RHiutt8B/2AlopGSqJM5L5IHhLpqRE 5ftzzLjILKy0BVs1LdQwDhSCFismCSqUD2PqSqx5438YqRGTWjjQzOuhF7c72b1xzij1 k7YuzxtGGDGkHS0ekzUW1Q5vl6Uq9FHGE7MhAbJQ7H5230zfJZxT+u2Oo8diGmoQs6GI rEVg== X-Gm-Message-State: ANhLgQ3NOvm4pDf1VHUxqMEkW2XVEZ+8SmK/WFjvzahGjAzHovZG3pyr ZXxUg1NEO5MXEOOWGAq+Z8n03Z1AJWY= X-Google-Smtp-Source: ADFU+vvD1qpp21Ifop6i/E6v5DtFA/BcJt6mva31ymXDMo0kh9BTapAtdyoKHg5QHxBx7zdtuJNL7g== X-Received: by 2002:a17:90a:266f:: with SMTP id l102mr2226936pje.67.1583315055152; Wed, 04 Mar 2020 01:44:15 -0800 (PST) Return-Path: Received: from localhost.localdomain ([222.67.15.87]) by smtp.gmail.com with ESMTPSA id s12sm4991252pgv.73.2020.03.04.01.44.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Mar 2020 01:44:14 -0800 (PST) From: "GuoMinJ" To: devel@edk2.groups.io Cc: GuoMinJ , Hao A Wu , Ray Ni Subject: [PATCH v2] MdeModulePkg/SdDxe: Potential NULL pointer on Token Date: Wed, 4 Mar 2020 17:41:18 +0800 Message-Id: X-Mailer: git-send-email 2.17.1 REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2286 Token pointer may be NULL, it is should be check before use it. Cc: Hao A Wu Cc: Ray Ni 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..0cc2e70b58 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; } -- 2.17.1