[PATCH] D148958: Size and element numbers are often swapped when calling calloc

Slava Zakharin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 21 14:40:36 PDT 2023


vzakhari added a comment.

In D148958#4288728 <https://reviews.llvm.org/D148958#4288728>, @MaskRay wrote:

> This is an unnecessary change. The arguments are interchangeable.
> In musl, there are at least 2 places where the parameters could be swapped, but I not unsure this warrants a commit.

Isn't the memory alignment dependent on the element size in general?  In this case it might be a potential correntess issue fix.
I understand that many `calloc` implementations may align them to works-for-all boundary, but it may still worth be "fixing".


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148958



More information about the cfe-commits mailing list