eenurkka opened a new pull request, #6953:
URL: https://github.com/apache/incubator-nuttx/pull/6953

   Fix the following cppcheck findings. Privreq may be NULL,
   thus perform checks before using its member variables.
   
   Checking mpfs_usb.c ...
   mpfs_usb.c:1093:12: warning: Possible null pointer dereference: privreq 
[nullPointer]
         if ((privreq->inflight > 0) && (count != 0) &&
              ^
   mpfs_usb.c:1090:21: note: Assignment 'privreq=NULL', assigned value is 0
             privreq = NULL;
                       ^
   mpfs_usb.c:1093:12: note: Null pointer dereference
         if ((privreq->inflight > 0) && (count != 0) &&
              ^
   mpfs_usb.c:1138:3: warning: Possible null pointer dereference: privreq 
[nullPointer]
     privreq->req.xfrd = 0;
     ^
   mpfs_usb.c:1130:21: note: Assignment 'privreq=NULL', assigned value is 0
             privreq = NULL;
                       ^
   mpfs_usb.c:1138:3: note: Null pointer dereference
     privreq->req.xfrd = 0;
     ^
   mpfs_usb.c:1139:3: warning: Possible null pointer dereference: privreq 
[nullPointer]
     privreq->inflight = privreq->req.len;
     ^
   mpfs_usb.c:1130:21: note: Assignment 'privreq=NULL', assigned value is 0
             privreq = NULL;
                       ^
   mpfs_usb.c:1139:3: note: Null pointer dereference
     privreq->inflight = privreq->req.len;
     ^
   mpfs_usb.c:1140:50: warning: Possible null pointer dereference: privreq 
[nullPointer]
     priv->eplist[epno].descb[0]->addr = (uintptr_t)privreq->req.buf;
                                                    ^
   mpfs_usb.c:1130:21: note: Assignment 'privreq=NULL', assigned value is 0
             privreq = NULL;
                       ^
   mpfs_usb.c:1140:50: note: Null pointer dereference
     priv->eplist[epno].descb[0]->addr = (uintptr_t)privreq->req.buf;
   
   Signed-off-by: Eero Nurkkala <eero.nurkk...@offcode.fi>
   
   ## Summary
   
   Fix potential trouble found with cppcheck (static code analysis tool).
   
   ## Impact
   
   MPFS USB
   
   ## Testing
   
   Polarfire kit, NuttX with Ubuntu 22.04 and Windows 10 (CDCACM and Mass 
storage).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to