mirror of
https://github.com/freebsd/freebsd-src
synced 2024-07-21 18:27:22 +00:00
loader/libofw: Fix disk size truncation
At present OF_ioctl first multiplies, then casts to 64-bit, meaning at the asm level it truncates the result to 32-bit, then zero-extends it to 64-bit to return. Cast `n` to 64-bit before multiplying, so that the correct result is returned.
This commit is contained in:
parent
f81cdf24ba
commit
cd6e526e26
|
@ -174,7 +174,7 @@ ofwd_ioctl(struct open_file *f, u_long cmd, void *data)
|
|||
case DIOCGMEDIASIZE:
|
||||
block_size = OF_block_size(dev->d_handle);
|
||||
n = OF_blocks(dev->d_handle);
|
||||
*(uint64_t *)data = (uint64_t)(n * block_size);
|
||||
*(uint64_t *)data = ((uint64_t)n * block_size);
|
||||
break;
|
||||
default:
|
||||
return (ENOTTY);
|
||||
|
|
Loading…
Reference in a new issue