From 1a2449aa37baf27d61c4232545e90570c42f2e3b Mon Sep 17 00:00:00 2001 From: Greg Kaiser Date: Thu, 12 Mar 2020 09:00:00 -0700 Subject: Fix get_block_device_size() for linux We were incorrectly passing a pointer to a pointer of an unsigned long long, when we just wanted to pass a pointer to the unsigned long long. This is especially bad on 32-bit systems, where we're then writing a 64-bits into a 32-bit value within ioctl. We fix this to pass a pointer to the unsigned long long. Test: On 32-bit device, no longer see native crash from toybox Bug: http://b/151311535 Signed-off-by: Elliott Hughes --- lib/portability.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/portability.c b/lib/portability.c index 145ac474..26b854d6 100644 --- a/lib/portability.c +++ b/lib/portability.c @@ -592,6 +592,6 @@ int get_block_device_size(int fd, unsigned long long* size) #elif defined(__linux__) int get_block_device_size(int fd, unsigned long long* size) { - return (ioctl(fd, BLKGETSIZE64, &size) >= 0); + return (ioctl(fd, BLKGETSIZE64, size) >= 0); } #endif -- cgit v1.2.3