Broken kernels (not-upstream) can provide wrong empty "comm" field.
It causes to segfault while printing in JSON format.
Fixes: 8ecac46a60ff ("rdma: Add QP resource tracking information")
Signed-off-by: Mark Zhang <markz@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
{
char tmp[18];
+ if (!str)
+ return;
+
if (rd->json_output) {
/* Don't beatify output in JSON format */
jsonw_string_field(rd->jw, "comm", str);