Resource data is restricted to root-only, and "daxctl list" is likely to be run by non-root. Skip listing memory-object details when the resource is not available.
Otherwise, "daxctl list" from non-root emits: libdaxctl: memblock_in_dev: dax1.0: Unable to determine resource Reported-by: Michal Biesek <[email protected]> Signed-off-by: Dan Williams <[email protected]> --- util/json.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/json.c b/util/json.c index 0abaf3a5b9c2..6745bcc19058 100644 --- a/util/json.c +++ b/util/json.c @@ -306,7 +306,7 @@ struct json_object *util_daxctl_dev_to_json(struct daxctl_dev *dev, if (jobj) json_object_object_add(jdev, "mode", jobj); - if (mem) { + if (mem && daxctl_dev_get_resource(dev) != 0) { movable = daxctl_memory_is_movable(mem); if (movable == 1) jobj = json_object_new_boolean(true); _______________________________________________ Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]
