From: Tom Rini Date: Fri, 19 Mar 2021 16:42:00 -0400 Subject: [PATCH u-boot] api: fix a potential serious bug caused by undef CONFIG_SYS_64BIT_LBA In-Reply-To: <20210306224322.3316-1-marek.behun@nic.cz> References: <20210306224322.3316-1-marek.behun@nic.cz> Message-ID: <20210319204200.GU1310@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Sat, Mar 06, 2021 at 11:43:22PM +0100, Marek Beh?n wrote: > The api_public.h header file undefined macro CONFIG_SYS_64BIT_LBA. > > But api/api_storage.c includes this header before including part.h, > causing the type of lbaint_t and subsequently the type signature of > blk_dread() and blk_dwrite() functions to change from the rest of U-Boot > (if CONFIG_SYS_64BIT_LBA is defined for the board). > > This is of course wrong, because the call to blk_dread() / blk_dwrite() > will recieve mangled arguments. > > Fix this by removing the undef of macro CONFIG_SYS_64BIT_LBA and instead > make the immediate code do what it would do as if the macro was not > defined. > > Add a FIXME to whoever is maintaining this code. > > CI managed to trigger this bug when compiling for lsxhl_defconfig, which > has CONFIG_API selected. The compiler complained about blk_dwrite() and > blk_dread() not matching original declarations: > > include/blk.h:280:15: warning: type of ?blk_dwrite? does not match > original declaration > [-Wlto-type-mismatch] > 280 | unsigned long blk_dwrite(struct blk_desc *block_dev, lbaint_t st > | ^ > drivers/block/blk-uclass.c:456:15: note: type mismatch in parameter 2 > 456 | unsigned long blk_dwrite(struct blk_desc *block_dev, lbaint_t st > | ^ > > Signed-off-by: Marek Beh?n > Reviewed-by: Simon Glass Applied to u-boot/master, thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: