From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by mx.groups.io with SMTP id smtpd.web10.609.1685640487018636683 for ; Thu, 01 Jun 2023 10:28:07 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="signature has expired" header.i=@gmail.com header.s=20221208 header.b=qIiitOgg; spf=pass (domain: gmail.com, ip: 209.85.128.50, mailfrom: pedro.falcato@gmail.com) Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-3f6094cb2d2so11886335e9.2 for ; Thu, 01 Jun 2023 10:28:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685640485; x=1688232485; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nU0/UWWIpG+UAI8IkPl00Z8VcQGK89ugm2NQLN8Bs+c=; b=qIiitOggms7t9nKj/zcEThKhpnPIkD+T55ylRlkz5ZeNTfUah/YS4hkanZwYVg1af+ bUa9CuqT0jgH2UMgiquFwD0WPfec8xWPd/u3pjVIspb0BPLpiTnyEQ/t8NZrSo+gytFQ IDGXtDlYo6V2/2lSpVOkAZ6O4bRvcawtjKYCpaVR4boI1V1HE5j43ywQe0DqEy70GEqb YvxWsTMTfRqXRoelEOB1/VZir0XqRP2VgHLHmLMHu6hAGMS3MNHAeYbq+YxksdC8IaTX hNRnTBkaRVrFga3r5yv5WRIY0wJUgNctH6cmw0X9ULTtPtT2KZ2urvkvZE4atydzEuy8 Lx/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685640485; x=1688232485; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nU0/UWWIpG+UAI8IkPl00Z8VcQGK89ugm2NQLN8Bs+c=; b=Dn4iHHz3SBDkt1SuVp/jKdik/LsRSGLNghdlzRiquUk7jhCSVfgUXESHnr+UA5l4Ky IbpVmO7qpaFB8LPf/z49JCayuvHl83mP8yCIWlXAC+Xug53Og5EMCfHMx0wKhvGatO5p afUCX2gPPZwvSFU4tljElEwg6PTh6kYtnUN9B3cpJwzY7Qx+1jT6o2jvKjkDw5iF3cXx 4SgoJ5LLga58Stz+tkBxEoKkFAQLc9Izj0L+/hwpWNETecRoB2Lav6Bz+fD3uNGc80JD APScJTWtS3/TyLcNsg+vHCgdq0NFzDCMJzVzoIew+pj7iqiVuYBfDt8qeVoHkXlqfi6N XYKQ== X-Gm-Message-State: AC+VfDyabYEjNeTz6HfDe5x8C/y+27NAqnWJ5ObRE8Fx+MHHFZNejFyY sEJfN1BUJOer3b3dePlTRn/XHmlas75QXQ== X-Google-Smtp-Source: ACHHUZ7OXZN1UL9pTs9liVb2zNntci96AX5hsuHGoTXpYZyct1h2re3yWyvp4hUCohvCrvWkqzc+ZA== X-Received: by 2002:a1c:6a04:0:b0:3f6:be1:b8d8 with SMTP id f4-20020a1c6a04000000b003f60be1b8d8mr80701wmc.14.1685640485246; Thu, 01 Jun 2023 10:28:05 -0700 (PDT) Return-Path: Received: from PC-PEDRO-ARCH.lan ([2001:8a0:7280:5801:9441:3dce:686c:bfc7]) by smtp.gmail.com with ESMTPSA id n11-20020a7bcbcb000000b003f60d0eef36sm2970511wmi.48.2023.06.01.10.28.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jun 2023 10:28:04 -0700 (PDT) From: "Pedro Falcato" To: devel@edk2.groups.io Cc: Pedro Falcato , Jian J Wang , Liming Gao , Hao A Wu , Ray Ni , Laszlo Ersek Subject: [PATCH v3 04/12] MdeModulePkg/SataControllerDxe: Fix up ASSERTS (Private != NULL) Date: Thu, 1 Jun 2023 18:27:32 +0100 Message-Id: <20230601172740.9165-5-pedro.falcato@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230601172740.9165-1-pedro.falcato@gmail.com> References: <20230601172740.9165-1-pedro.falcato@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ASSERT (Private != NULL) (where Private = CR(...)) is ineffective as CR(Ptr, Type, Member, Sig) either returns Ptr - offsetof(Type, Member), or ASSERTS on the signature, so it's unlikely to ever return NULL (must be passed a pointer = member's offset, or in this case, 0x4). ASSERT on This != NULL instead. Cc: Jian J Wang Cc: Liming Gao Cc: Hao A Wu Cc: Ray Ni Cc: Laszlo Ersek Signed-off-by: Pedro Falcato Reviewed-by: Laszlo Ersek Reviewed-by: Hao A Wu --- MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c b/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c index f0ffd311d7b9..ea0116071c6a 100644 --- a/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c +++ b/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c @@ -611,7 +611,6 @@ SataControllerStop ( } Private = SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS (IdeInit); - ASSERT (Private != NULL); // // Uninstall the IDE Controller Init Protocol from this instance @@ -745,8 +744,8 @@ IdeInitGetChannelInfo ( { EFI_SATA_CONTROLLER_PRIVATE_DATA *Private; + ASSERT (This != NULL); Private = SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS (This); - ASSERT (Private != NULL); if (Channel < This->ChannelCount) { *Enabled = TRUE; @@ -845,8 +844,8 @@ IdeInitSubmitData ( EFI_SATA_CONTROLLER_PRIVATE_DATA *Private; UINTN DeviceIndex; + ASSERT (This != NULL); Private = SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS (This); - ASSERT (Private != NULL); if ((Channel >= This->ChannelCount) || (Device >= Private->DeviceCount)) { return EFI_INVALID_PARAMETER; @@ -924,8 +923,8 @@ IdeInitDisqualifyMode ( EFI_SATA_CONTROLLER_PRIVATE_DATA *Private; UINTN DeviceIndex; + ASSERT (This != NULL); Private = SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS (This); - ASSERT (Private != NULL); if ((Channel >= This->ChannelCount) || (BadModes == NULL) || (Device >= Private->DeviceCount)) { return EFI_INVALID_PARAMETER; @@ -1017,8 +1016,8 @@ IdeInitCalculateMode ( EFI_STATUS Status; UINTN DeviceIndex; + ASSERT (This != NULL); Private = SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS (This); - ASSERT (Private != NULL); if ((Channel >= This->ChannelCount) || (SupportedModes == NULL) || (Device >= Private->DeviceCount)) { return EFI_INVALID_PARAMETER; -- 2.40.1