[U-Boot] [PATCH 1/1] cmd/host: avoid segmentation fault for 'host info'

Heinrich Schuchardt xypron.glpk at gmx.de
Mon Aug 26 17:20:54 UTC 2019


Without the patch a segmentation fault is caused by 'host info' if
CONFIG_BLK=y:

    make sandbox_defconfig
    make
    ./u-boot
    => host bind 0 ../sct-amd64.img
    => host info 0
    dev       blocks path
      0 Segmentation fault

Use the platform data to find the filename.

Fixes: 8f994c860d91 ("sandbox: blk: Switch to use platdata_auto_alloc_size
for the driver data")
Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
 cmd/host.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd/host.c b/cmd/host.c
index f7d3eae5b1..98c4d2a099 100644
--- a/cmd/host.c
+++ b/cmd/host.c
@@ -89,7 +89,7 @@ static int do_host_info(cmd_tbl_t *cmdtp, int flag, int argc,
 		struct host_block_dev *host_dev;

 #ifdef CONFIG_BLK
-		host_dev = dev_get_priv(blk_dev->bdev);
+		host_dev = dev_get_platdata(blk_dev->bdev);
 #else
 		host_dev = blk_dev->priv;
 #endif
--
2.20.1



More information about the U-Boot mailing list