From patchwork Mon Sep 27 04:30:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 514654 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp3768822jao; Sun, 26 Sep 2021 21:31:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyr0gzVL+HQPwFwBLTn6VOpdEV2UG/4ABtECOnSRs99gDfwfWYPOF0Yj4CSIkX4uF6SryGt X-Received: by 2002:a17:906:25d4:: with SMTP id n20mr25246598ejb.399.1632717078831; Sun, 26 Sep 2021 21:31:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632717078; cv=none; d=google.com; s=arc-20160816; b=GF6Qvx/UVOmerFXUs31T3luMOW1wSZgnJCXJey6mh3UmgoQ3dKvvSb6kix5XH2eEI8 VA7HLlQN7xlMVyxKK7w0tX3GqaRvrG9V3NSj+nnFZpYOBuvjxVSGGkUTztTBPZgnfGK5 qt5YPphCGCHv2Xug1HbKjlPAMkbNO5boza4fmL99nMEk88TBbTmv6lHfDiKu/JGu8JFd h9tETEcsWORuuU+j7L0Y6O881qLtRD1wwvM/bI2SYw4vKrbVxyP4f+FN4EGZJTCXdBtf ZS8gmcPKXjvYP9c68MkqO0J2nTgvGNs/WAObB5PqNv63WGuoi1B3XT2/tU5ubqKk5Mjt kx7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=dHIGMxyzG7zjkJ0xX289xJnwBCwy7I7XTn8/ojJ3qH4=; b=PThReoddJQN0ZJX7aFYJV3IUzcJxRnFUFQdop5Wv9CLu0VxkTZoU7LPGDQLTLGQaNP AWxRXd6nYlPwukG1JAbjBoB4nECPedkINYnoKUFXo3fHbX4Gej/q/urFZO7MIjufR/N9 RpOuep7FkehoxAoUK1cVgZUCOaMYQi5owyWFqtGarsHm9Rc7SNyYUSSxRYFmroqMPKim 4nY8vhycUZm3em7ytWOyPoaDeYfEDcXWAX6AJzEg/btDSm+ZoGJKta5yJb2DVZkzMhab VqPpBGo0Ft66iEZ2prPz4SQOfXDkwxQJnGxW2cSV5o3UrZXMw+curtOB9pg+vLcF3p5G Rv0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=flh4Xwwn; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 1si17657572ejg.330.2021.09.26.21.31.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Sep 2021 21:31:18 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=flh4Xwwn; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7C827832C4; Mon, 27 Sep 2021 06:31:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="flh4Xwwn"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7EB0F83457; Mon, 27 Sep 2021 06:31:14 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1EFD683230 for ; Mon, 27 Sep 2021 06:31:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pf1-x429.google.com with SMTP id n23so11795242pfv.4 for ; Sun, 26 Sep 2021 21:31:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=dHIGMxyzG7zjkJ0xX289xJnwBCwy7I7XTn8/ojJ3qH4=; b=flh4XwwnbfYQBClv6hO9pgVu8rVLcmH4v42y2WwrRwL7enRO+JiBPeP32ICNXv17uB ZwY7h04u587kSTFxqGqWUvHqgz0KZmx+ENZR2Gc4KtWme0QC4BnWqzmEcprPJvJwhSVB 56m99hPEqZ7Q1r0APVtSFBduJmLif+NxUp0xGkbgY5fUcq54ZfZ3eC7kwPyXMSGqXtiq k+5r0SrPjPokVKARxoAw3hVZdLMu806aGu6Z4I3FRRvMydx7mZTkWd62vF0Ew2FFW6Ls 7xADIWnRVjgiVw+sgqjaG3jxHrDxpixPcrznQ3x4p3EL8i2IcaJANMOZYOGbajm9d7iZ cROQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=dHIGMxyzG7zjkJ0xX289xJnwBCwy7I7XTn8/ojJ3qH4=; b=NtA2fCnICMDMMWmElYopQsgdrfUTVlefv3+mSX2kk7WmFBVAdsLAf6AkJ9FT+kpnQy om7O3XxE20AxBIyIKmBk9d6QN1hMVLfERIs0fn1w/ggm0xOsZ5oKJ48su6Vjnf+1nFCv vr9sEId9iehwVw6bP0qBZv7Cmd/Wp7JrMNpErwCXckZrZ0MKhbG6ZiEypxMcprdQrPZ6 TvfC5JXdlzNv9usvns6o1yRFiqZh+2kLoVXSqcf6RtEwA5uoGb7x9igSEplhl8Tfc8oG hb+IOEx1Aje//Rb2+WQtCmnUP4Av7zvhTvEKWKtxK6R4E8tdH5ZZzyPOXgGYIPLE905w zoBQ== X-Gm-Message-State: AOAM532HcW+E8YwLngJcLGkNC75Zzpoe/W/N5pITAfcAZ1zc8dbUadD2 jZ+txNsCYCE+tP7gKCd4OMrTuQ== X-Received: by 2002:aa7:80d9:0:b029:2ed:49fa:6dc5 with SMTP id a25-20020aa780d90000b02902ed49fa6dc5mr21728165pfn.3.1632717069175; Sun, 26 Sep 2021 21:31:09 -0700 (PDT) Received: from localhost.localdomain (p6e421539.tkyea130.ap.so-net.ne.jp. [110.66.21.57]) by smtp.gmail.com with ESMTPSA id l18sm6666445pfu.202.2021.09.26.21.31.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Sep 2021 21:31:08 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de Cc: u-boot@lists.denx.de, AKASHI Takahiro Subject: [PATCH] efi_driver: fix a wrong cast Date: Mon, 27 Sep 2021 13:30:54 +0900 Message-Id: <20210927043054.32727-1-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean struct efi_driver_binding_protocol, i.e. bp, is not the first element in struct efi_driver_binding_extended_protocol. So the casting: struct efi_driver_binding_extended_protocol *bp = (struct efi_driver_binding_extended_protocol *)this; is simply wrong. Signed-off-by: AKASHI Takahiro --- lib/efi_driver/efi_uclass.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.33.0 diff --git a/lib/efi_driver/efi_uclass.c b/lib/efi_driver/efi_uclass.c index 382c2b477f4d..9e784f9c237f 100644 --- a/lib/efi_driver/efi_uclass.c +++ b/lib/efi_driver/efi_uclass.c @@ -65,8 +65,8 @@ static efi_status_t EFIAPI efi_uc_supported( { efi_status_t r, ret; void *interface; - struct efi_driver_binding_extended_protocol *bp = - (struct efi_driver_binding_extended_protocol *)this; + struct efi_driver_binding_extended_protocol *bp = container_of(this, + struct efi_driver_binding_extended_protocol, bp); EFI_ENTRY("%p, %p, %ls", this, controller_handle, efi_dp_str(remaining_device_path)); @@ -113,8 +113,8 @@ static efi_status_t EFIAPI efi_uc_start( { efi_status_t r, ret; void *interface = NULL; - struct efi_driver_binding_extended_protocol *bp = - (struct efi_driver_binding_extended_protocol *)this; + struct efi_driver_binding_extended_protocol *bp = container_of(this, + struct efi_driver_binding_extended_protocol, bp); EFI_ENTRY("%p, %p, %ls", this, controller_handle, efi_dp_str(remaining_device_path)); @@ -201,8 +201,8 @@ static efi_status_t EFIAPI efi_uc_stop( efi_status_t ret; efi_uintn_t count; struct efi_open_protocol_info_entry *entry_buffer; - struct efi_driver_binding_extended_protocol *bp = - (struct efi_driver_binding_extended_protocol *)this; + struct efi_driver_binding_extended_protocol *bp = container_of(this, + struct efi_driver_binding_extended_protocol, bp); EFI_ENTRY("%p, %p, %zu, %p", this, controller_handle, number_of_children, child_handle_buffer); @@ -283,7 +283,7 @@ static efi_status_t efi_add_driver(struct driver *drv) } bp->bp.image_handle = bp->bp.driver_binding_handle; ret = efi_add_protocol(bp->bp.driver_binding_handle, - &efi_guid_driver_binding_protocol, bp); + &efi_guid_driver_binding_protocol, &bp->bp); if (ret != EFI_SUCCESS) { efi_delete_handle(bp->bp.driver_binding_handle); free(bp);