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

Alexey Moksyakov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 1 01:08:45 PDT 2022


yavtuk updated this revision to Diff 441629.
yavtuk added a comment.

updated commit message


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

https://reviews.llvm.org/D128971

Files:
  bolt/runtime/hugify.cpp


Index: bolt/runtime/hugify.cpp
===================================================================
--- bolt/runtime/hugify.cpp
+++ bolt/runtime/hugify.cpp
@@ -27,7 +27,7 @@
 #ifdef MADV_HUGEPAGE
 /// Check whether the kernel supports THP via corresponding sysfs entry.
 static bool has_pagecache_thp_support() {
-  char buf[256] = {0};
+  char buf[256];
   const char *madviseStr = "always [madvise] never";
 
   int fd = __open("/sys/kernel/mm/transparent_hugepage/enabled",
@@ -35,6 +35,7 @@
   if (fd < 0)
     return false;
 
+  memSet(buf, 0, sizeof(buf));
   size_t res = __read(fd, buf, 256);
   if (res < 0)
     return false;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128971.441629.patch
Type: text/x-patch
Size: 635 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220701/8676b471/attachment.bin>


More information about the llvm-commits mailing list