[PATCH] D128971: [BOLT] Avoid implicit memset in hugify

Vladislav Khmelevsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 1 01:23:10 PDT 2022


yota9 added a comment.

Just curious is there any reason to memset this buffer? It will be overwritten by read anyway, probably buf[0] = '\0' is more then enough here. And looks like the size might be truncated to smth like 32-64, what do you think?



================
Comment at: bolt/runtime/hugify.cpp:39
+  memSet(buf, 0, sizeof(buf));
   size_t res = __read(fd, buf, 256);
   if (res < 0)
----------------
This is OOS but sizeof(buf) if you don't mind


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128971



More information about the llvm-commits mailing list