This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new b04c4972fe mtd/smartfs: Fix uninitialized variable
b04c4972fe is described below

commit b04c4972fe32c33e38ef60ac7fdc9b7bbbc2dda1
Author: SPRESENSE <[email protected]>
AuthorDate: Tue Jul 19 15:00:11 2022 +0900

    mtd/smartfs: Fix uninitialized variable
    
    If CONFIG_SMARTFS_MULTI_ROOT_DIRS is enabled and dev->partname is not empty,
    dev->rwbuffer is an uninitialized variable and register_blockdriver is 
called.
---
 drivers/mtd/smart.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/mtd/smart.c b/drivers/mtd/smart.c
index 7fced45542..2a8327803b 100644
--- a/drivers/mtd/smart.c
+++ b/drivers/mtd/smart.c
@@ -2192,8 +2192,7 @@ static int smart_scan(FAR struct smart_struct_s *dev)
             {
               if (dev->partname[0] != '\0')
                 {
-                  snprintf(dev->rwbuffer, sizeof(devname),
-                           "/dev/smart%d%sd%d",
+                  snprintf(devname, sizeof(devname), "/dev/smart%d%sd%d",
                            dev->minor, dev->partname, x + 1);
                 }
               else
@@ -2219,8 +2218,6 @@ static int smart_scan(FAR struct smart_struct_s *dev)
 
               rootdirdev->dev = dev;
               rootdirdev->rootdirnum = x;
-              ret = register_blockdriver(dev->rwbuffer, &g_bops, 0,
-                                         rootdirdev);
 
               /* Inode private data is a reference to the SMART device
                * structure.

Reply via email to