Skip to contentSkip to conversation

misc fixes and cleanup

PATCH New Vishal Verma 1 participant 3 messages Jul 22, 2020 libnvdimm: non-volatile memory device

lore
Share & tools
lore

Vishal Verma

author maintainer
#0 lore raw

cover misc fixes and cleanup

Patch 1 is a README update in the Unit tests section to include CONFIG_ENCRYPTED_KEYS in the list of config items required for unit tests.

Patch 2 fixes a potential resource leak found during static analysis

Vishal Verma (2):
ndctl/README: Add CONFIG_ENCRYPTED_KEYS to the config items list ndctl/namespace: fix a resource leak in file_write_infoblock()

 README.md         | 1 +
 ndctl/namespace.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
Signature · 4 lines
2.26.2
_______________________________________________
Linux-nvdimm mailing list -- [email protected]
To unsubscribe send an email to [email protected]
author maintainer
#1 lore raw

PATCH 1/2 ndctl/README: Add CONFIG_ENCRYPTED_KEYS to the config items list

CONFIG_ENCRYPTED_KEYS is required for test/security.sh (and generally for security operations). It defaults to 'N', so call it out in the list of config items for nfit_test.

---
 README.md | 1 +
 1 file changed, 1 insertion(+)
README.md +1 -0
index d296c6b..89dfc87 100644
@@ -65,6 +65,7 @@ loaded.  To build and install nfit_test.ko:
    CONFIG_NVDIMM_PFN=y
    CONFIG_NVDIMM_DAX=y
    CONFIG_DEV_DAX_PMEM=m
+   CONFIG_ENCRYPTED_KEYS=y
    ```
 
 1. Build and install the unit test enabled libnvdimm modules in the
Signature · 4 lines
2.26.2
_______________________________________________
Linux-nvdimm mailing list -- [email protected]
To unsubscribe send an email to [email protected]
author maintainer
#2 lore raw

PATCH 2/2 ndctl/namespace: fix a resource leak in file_write_infoblock()

In reply to Vishal Verma

Static analysis showed that we might leak 'fd' in the given function. Fix the error path to close(fd) if 'fd >= 0' rather than just 'fd > 0'.

Fixes 7787807bcffe ("ndctl/namespace: Add write-infoblock command")
Cc Dan Williams <[email protected]>
---
 ndctl/namespace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ndctl/namespace.c +1 -1
index 8aa5a42..e734248 100644
@@ -1969,7 +1969,7 @@ static int file_write_infoblock(const char *path)
 
 	free(buf);
 out:
-	if (fd > 0 && fd != STDOUT_FILENO)
+	if (fd >= 0 && fd != STDOUT_FILENO)
 		close(fd);
 	return rc;
 }
Signature · 4 lines
2.26.2
_______________________________________________
Linux-nvdimm mailing list -- [email protected]
To unsubscribe send an email to [email protected]