[DTrace-devel] [PATCH 3/5] Allow NULL as map name in dt_bpf_map_create()

Eugene Loh eugene.loh at oracle.com
Mon Aug 22 19:14:26 UTC 2022


Reviewed-by: Eugene Loh <eugene.loh at oracle.com>

Incidentally, it might be better to indent starting MIN() on its own line.  I know this predates this patch, but now might be a reasonable time to change it.
________________________________
From: Kris Van Hees via DTrace-devel <dtrace-devel at oss.oracle.com>
Sent: Friday, August 19, 2022 10:26 AM
To: dtrace-devel at oss.oracle.com <dtrace-devel at oss.oracle.com>
Subject: [DTrace-devel] [PATCH 3/5] Allow NULL as map name in dt_bpf_map_create()

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
---
 libdtrace/dt_bpf.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libdtrace/dt_bpf.c b/libdtrace/dt_bpf.c
index e92d34ee..7a886278 100644
--- a/libdtrace/dt_bpf.c
+++ b/libdtrace/dt_bpf.c
@@ -113,8 +113,9 @@ dt_bpf_map_create(enum bpf_map_type map_type, const char *name,
         attr.value_size = value_size;
         attr.max_entries = max_entries;
         attr.map_flags = map_flags;
-       memcpy(attr.map_name, name, MIN(strlen(name),
-                                       sizeof(attr.map_name) - 1));
+       if (name)
+               memcpy(attr.map_name, name, MIN(strlen(name),
+                                               sizeof(attr.map_name) - 1));

         return bpf(BPF_MAP_CREATE, &attr);
 }
--
2.34.1


_______________________________________________
DTrace-devel mailing list
DTrace-devel at oss.oracle.com
https://oss.oracle.com/mailman/listinfo/dtrace-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://oss.oracle.com/pipermail/dtrace-devel/attachments/20220822/7be2e785/attachment.html>


More information about the DTrace-devel mailing list