erik.pilkington marked 4 inline comments as done. erik.pilkington added a comment.
In D58797#1438975 <https://reviews.llvm.org/D58797#1438975>, @nickdesaulniers wrote: > This is causing false positive warnings for the Linux kernel: > https://github.com/ClangBuiltLinux/linux/issues/423 > :( > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/statfs.c#n128 > Consider this untested case (when the condition is false): > > if (sizeof(buf) == sizeof(*st)) > memcpy(&buf, st, sizeof(*st)); > > > fs/statfs.c:129:3: warning: 'memcpy' will always overflow; destination buffer > has size 64, but size argument is 88 [-Wfortify-source] > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/statfs.c#n169, > too. Ah, I didn't consider that case. Presumably `st` is configured to have different sizes based on the target? I agree that this is a false-positive, but it seems like a pretty narrow edge case, and there is a pretty obvious source workaround that doesn't affect readability: `memcpy(&buf, st, sizeof(buf))`. @aaron.ballman/@rsmith Any thoughts here? IMO keeping this diagnostic is worth it. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D58797/new/ https://reviews.llvm.org/D58797 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits