[LTP] ioctl10: fix the sscanf() call to handle 64-bit inode on 32-bit arch
linuxtestproject.agent@gmail.com
linuxtestproject.agent@gmail.com
Fri Jun 26 19:54:21 CEST 2026
Hi Jeff,
On Fri, 26 Jun 2026, Jeff Layton wrote:
> ioctl10: fix the sscanf() call to handle 64-bit inode on 32-bit arch
> - unsigned long vm_inode;
> + uint64_t vm_inode;
> - if (sscanf(line, "%lx-%lx %s %lx %x:%x %lu %s",
> + if (sscanf(line, "%lx-%lx %s %lx %x:%x %llu %s",
The type change to uint64_t is correct, but %llu is the format
specifier for unsigned long long, not for uint64_t. On LP64
platforms (x86_64, aarch64), uint64_t is unsigned long, so passing
a uint64_t * where sscanf expects unsigned long long * is
undefined behavior and will produce -Wformat warnings on 64-bit
builds.
The portable fix is to use SCNu64 from <inttypes.h>:
if (sscanf(line, "%lx-%lx %s %lx %x:%x %" SCNu64 " %s",
Verdict - Needs revision
---
Note:
The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
More information about the ltp
mailing list