[PATCH] D94640: adds more checks to -Wfree-nonheap-object

Christopher Di Bella via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 26 09:27:53 PST 2021


cjdb added a comment.

In D94640#2590512 <https://reviews.llvm.org/D94640#2590512>, @thakis wrote:

> This seems to flag https://source.chromium.org/chromium/chromium/src/+/master:third_party/libsync/src/sync.c;l=142?q=sync.c&ss=chromium :
>
>   info->sync_fence_info = (uint64_t) calloc(num_fences,
>                                   sizeof(struct sync_fence_info));
>   if ((void *)info->sync_fence_info == NULL)
>       goto free;
>   
>   err = ioctl(fd, SYNC_IOC_FILE_INFO, info);
>   if (err < 0) {
>       free((void *)info->sync_fence_info);
>       goto free;
>   }
>
> What's the motivation for flagging an integer that's >= sizeof(void*) and that's explicitly cast to void*? That seems like code that's pretty explicit about its intentions.
>
> Did you do true positive / false positive evaluation of this change?

This change was a bit too aggressive and is being rolled back in D97512 <https://reviews.llvm.org/D97512>.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94640/new/

https://reviews.llvm.org/D94640



More information about the cfe-commits mailing list