crypto/ccp: fix resource leak
Subsystems (2)
PATCH 1/1 crypto/ccp: fix resource leak
File *fp, opened but not closed, this patch add fclose(fp)
Fixes ef4b04f87fa6 ("crypto/ccp: support device init")
Signed-off-by Ferruh Yigit <[email protected]>
--- drivers/crypto/ccp/ccp_pci.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/crypto/ccp/ccp_pci.c +4 -1
@@ -31,12 +31,15 @@ ccp_check_pci_uio_module(void)while (uio_module_names[i] !=NULL ) {while (fgets (buf,sizeof (buf), fp) !=NULL ) {if (!strncmp (buf, uio_module_names[i], -strlen (uio_module_names[i]))) +strlen (uio_module_names[i]))) { +fclose (fp);return i; + } } i++;rewind (fp); } +fclose (fp);printf ("Insert igb_uio or uio_pci_generic kernel module(s)" );return -1 ;/* uio not inserted */ }
Signature · 1 line
2.17.2
Quoted 31 lines
File *fp, opened but not closed, this patch add fclose(fp)
Fixes ef4b04f87fa6 ("crypto/ccp: support device init")Signed-off-by Ferruh Yigit <[email protected]>---
drivers/crypto/ccp/ccp_pci.c| 5 ++++-1 file changed, 4 insertions(+), 1 deletion(-)drivers/crypto/ccp/ccp_pci.c +4
-2@@ -31,12 +31,15 @@ ccp_check_pci_uio_module(void)while (uio_module_names[i] !=NULL ) {while (fgets (buf,sizeof (buf), fp) !=NULL ) {if (!strncmp (buf, uio_module_names[i], -strlen (uio_module_names[i]))) +strlen (uio_module_names[i]))) { +fclose (fp);return i; + } } i++;rewind (fp); } +fclose (fp);printf ("Insert igb_uio or uio_pci_generic kernel module(s)" );return -1 ;/* uio not inserted */ } --
Quoted 2 lines
2.17.2
Thanks Ferruh for the find. Looks good to me.
Regards,
Ravi
Quoted 35 lines · On 11/4/2018 10:20 AM, Kumar, Ravi1 wrote:
Quoted 31 lines
File *fp, opened but not closed, this patch add fclose(fp)
Fixes ef4b04f87fa6 ("crypto/ccp: support device init")Signed-off-by Ferruh Yigit <[email protected]>---
drivers/crypto/ccp/ccp_pci.c| 5 ++++-1 file changed, 4 insertions(+), 1 deletion(-)drivers/crypto/ccp/ccp_pci.c +4
-2@@ -31,12 +31,15 @@ ccp_check_pci_uio_module(void)while (uio_module_names[i] !=NULL ) {while (fgets (buf,sizeof (buf), fp) !=NULL ) {if (!strncmp (buf, uio_module_names[i], -strlen (uio_module_names[i]))) +strlen (uio_module_names[i]))) { +fclose (fp);return i; + } } i++;rewind (fp); } +fclose (fp);printf ("Insert igb_uio or uio_pci_generic kernel module(s)" );return -1 ;/* uio not inserted */ } --Quoted 2 lines
2.17.2
Thanks Ferruh for the find. Looks good to me.
Quoted 2 lines
Regards,
Ravi
Added Reviewed-by from Ravi.
Applied to dpdk-next-crypto
Thanks