linux-nvdimm.lists.01.org archive mirror
 help / color / mirror / Atom feed
* [ndctl PATCH 0/2] misc fixes and cleanup
@ 2020-07-22  5:26 Vishal Verma
  2020-07-22  5:26 ` [ndctl PATCH 1/2] ndctl/README: Add CONFIG_ENCRYPTED_KEYS to the config items list Vishal Verma
  2020-07-22  5:26 ` [ndctl PATCH 2/2] ndctl/namespace: fix a resource leak in file_write_infoblock() Vishal Verma
  0 siblings, 2 replies; 3+ messages in thread
From: Vishal Verma @ 2020-07-22  5:26 UTC (permalink / raw)
  To: linux-nvdimm; +Cc: Dan Williams, Vishal Verma

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(-)

-- 
2.26.2
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ndctl PATCH 1/2] ndctl/README: Add CONFIG_ENCRYPTED_KEYS to the config items list
  2020-07-22  5:26 [ndctl PATCH 0/2] misc fixes and cleanup Vishal Verma
@ 2020-07-22  5:26 ` Vishal Verma
  2020-07-22  5:26 ` [ndctl PATCH 2/2] ndctl/namespace: fix a resource leak in file_write_infoblock() Vishal Verma
  1 sibling, 0 replies; 3+ messages in thread
From: Vishal Verma @ 2020-07-22  5:26 UTC (permalink / raw)
  To: linux-nvdimm; +Cc: Dan Williams, Vishal Verma

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.

Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
 README.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/README.md b/README.md
index d296c6b..89dfc87 100644
--- a/README.md
+++ b/README.md
@@ -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
-- 
2.26.2
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [ndctl PATCH 2/2] ndctl/namespace: fix a resource leak in file_write_infoblock()
  2020-07-22  5:26 [ndctl PATCH 0/2] misc fixes and cleanup Vishal Verma
  2020-07-22  5:26 ` [ndctl PATCH 1/2] ndctl/README: Add CONFIG_ENCRYPTED_KEYS to the config items list Vishal Verma
@ 2020-07-22  5:26 ` Vishal Verma
  1 sibling, 0 replies; 3+ messages in thread
From: Vishal Verma @ 2020-07-22  5:26 UTC (permalink / raw)
  To: linux-nvdimm; +Cc: Dan Williams, 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 <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
 ndctl/namespace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index 8aa5a42..e734248 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -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;
 }
-- 
2.26.2
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-22  5:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-22  5:26 [ndctl PATCH 0/2] misc fixes and cleanup Vishal Verma
2020-07-22  5:26 ` [ndctl PATCH 1/2] ndctl/README: Add CONFIG_ENCRYPTED_KEYS to the config items list Vishal Verma
2020-07-22  5:26 ` [ndctl PATCH 2/2] ndctl/namespace: fix a resource leak in file_write_infoblock() Vishal Verma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).