ALTracer commented on code in PR #6605: URL: https://github.com/apache/incubator-nuttx/pull/6605#discussion_r921966422
########## fs/mount/fs_procfs_mount.c: ########## @@ -256,11 +261,39 @@ static int blocks_entry(FAR const char *mountpoint, /* Generate blocks list one line at a time */ - mount_sprintf(info, "%6lu %10" PRIuOFF " %10" PRIuOFF +#ifdef CONFIG_LIBC_LONG_LONG + mount_sprintf(info, "%6zu %10" PRIuOFF " %10" PRIuOFF " %10" PRIuOFF " %s\n", statbuf->f_bsize, statbuf->f_blocks, statbuf->f_blocks - statbuf->f_bavail, statbuf->f_bavail, mountpoint); +#else +# if defined(CONFIG_FS_LARGEFILE) && defined(CONFIG_HAVE_LONG_LONG) + if (statbuf->f_blocks > ULONG_MAX) + { + fwarn("Detected unsigned overflow in 'Blocks', upper word = %lu\n", + (uint32_t)(statbuf->f_blocks >> 32)); + } + + if ((statbuf->f_blocks - statbuf->f_bavail) > ULONG_MAX) + { + fwarn("Detected unsigned overflow in 'Used', upper word = %lu\n", + (uint32_t)((statbuf->f_blocks - statbuf->f_bavail) >> 32)); + } + + if (statbuf->f_bavail > ULONG_MAX) + { + fwarn("Detected unsigned overflow in 'Avail', upper word = %lu\n", Review Comment: Oh, yes, that is clever. I had something similar in mind while staring at three nearly identical strings. I'm just not as proficient in juggling format-strings like that. Will test locally. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org