<div dir="auto">At least one of them is clear how to fix.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">---------- Forwarded message ---------<br>From: <span dir="auto"><<a href="mailto:scan-admin@coverity.com">scan-admin@coverity.com</a>></span><br>Date: Tue, May 16, 2023, 12:57 AM<br>Subject: New Defects reported by Coverity Scan for RTEMS<br>To:  <<a href="mailto:build@rtems.org">build@rtems.org</a>><br></div><br><br>Hi,<br>
<br>
Please find the latest report on new defect(s) introduced to RTEMS found with Coverity Scan.<br>
<br>
2 new defect(s) introduced to RTEMS found with Coverity Scan.<br>
<br>
<br>
New defect(s) Reported-by: Coverity Scan<br>
Showing 2 of 2 defect(s)<br>
<br>
<br>
** CID 1530126:  Resource leaks  (RESOURCE_LEAK)<br>
/cpukit/libmisc/shell/main_flashdev.c: 184 in flashdev_shell_read()<br>
<br>
<br>
________________________________________________________________________________________________________<br>
*** CID 1530126:  Resource leaks  (RESOURCE_LEAK)<br>
/cpukit/libmisc/shell/main_flashdev.c: 184 in flashdev_shell_read()<br>
178       }<br>
179     <br>
180       /* Create a buffer to read into */<br>
181       buffer = calloc((bytes + bytes%4), 1);<br>
182       if (buffer == NULL) {<br>
183         printf("Failed to allocate read buffer\n");<br>
>>>     CID 1530126:  Resource leaks  (RESOURCE_LEAK)<br>
>>>     Handle variable "fd" going out of scope leaks the handle.<br>
184         return -1;<br>
185       }<br>
186     <br>
187       /* Read into buffer */<br>
188       status = read(fd, buffer, bytes);<br>
189       if (status == -1) {<br>
<br>
** CID 1530125:    (FORWARD_NULL)<br>
<br>
<br>
________________________________________________________________________________________________________<br>
*** CID 1530125:    (FORWARD_NULL)<br>
/cpukit/libmisc/shell/main_flashdev.c: 105 in rtems_flashdev_shell_main()<br>
99             return flashdev_shell_page_off(dev_path, argc, &argv[i]);<br>
100           case ('i'):<br>
101             /* Page info by index */<br>
102             return flashdev_shell_page_idx(dev_path, argc, &argv[i]);<br>
103           case ('p'):<br>
104             /* Page count */<br>
>>>     CID 1530125:    (FORWARD_NULL)<br>
>>>     Passing null pointer "dev_path" to "flashdev_shell_pg_count", which dereferences it.<br>
105             return flashdev_shell_pg_count(dev_path);<br>
106           case ('b'):<br>
107             /* Write block size */<br>
108             return flashdev_shell_wb_size(dev_path);<br>
109           case ('h'):<br>
110           default:<br>
/cpukit/libmisc/shell/main_flashdev.c: 96 in rtems_flashdev_shell_main()<br>
90             return flashdev_shell_erase(dev_path, argc, &argv[i]);<br>
91           case ('t'):<br>
92             /* Flash Type */<br>
93             return flashdev_shell_type(dev_path);<br>
94           case ('d'):<br>
95             /* JEDEC Id */<br>
>>>     CID 1530125:    (FORWARD_NULL)<br>
>>>     Passing null pointer "dev_path" to "flashdev_shell_jedecid", which dereferences it.<br>
96             return flashdev_shell_jedecid(dev_path);<br>
97           case ('o'):<br>
98             /* Page info by offset */<br>
99             return flashdev_shell_page_off(dev_path, argc, &argv[i]);<br>
100           case ('i'):<br>
101             /* Page info by index */<br>
/cpukit/libmisc/shell/main_flashdev.c: 108 in rtems_flashdev_shell_main()<br>
102             return flashdev_shell_page_idx(dev_path, argc, &argv[i]);<br>
103           case ('p'):<br>
104             /* Page count */<br>
105             return flashdev_shell_pg_count(dev_path);<br>
106           case ('b'):<br>
107             /* Write block size */<br>
>>>     CID 1530125:    (FORWARD_NULL)<br>
>>>     Passing null pointer "dev_path" to "flashdev_shell_wb_size", which dereferences it.<br>
108             return flashdev_shell_wb_size(dev_path);<br>
109           case ('h'):<br>
110           default:<br>
111             /* Help */<br>
112             printf(rtems_flashdev_shell_usage);<br>
113             break;<br>
/cpukit/libmisc/shell/main_flashdev.c: 93 in rtems_flashdev_shell_main()<br>
87             return flashdev_shell_write(dev_path, argc, &argv[i]);<br>
88           case ('e'):<br>
89             /* Erase */<br>
90             return flashdev_shell_erase(dev_path, argc, &argv[i]);<br>
91           case ('t'):<br>
92             /* Flash Type */<br>
>>>     CID 1530125:    (FORWARD_NULL)<br>
>>>     Passing null pointer "dev_path" to "flashdev_shell_type", which dereferences it.<br>
93             return flashdev_shell_type(dev_path);<br>
94           case ('d'):<br>
95             /* JEDEC Id */<br>
96             return flashdev_shell_jedecid(dev_path);<br>
97           case ('o'):<br>
98             /* Page info by offset */<br>
<br>
<br>
________________________________________________________________________________________________________<br>
To view the defects in Coverity Scan visit, <a href="https://u15810271.ct.sendgrid.net/ls/click?upn=HRESupC-2F2Czv4BOaCWWCy7my0P0qcxCbhZ31OYv50ypUUzi-2FdSNmuyRB7BEFT8xQ4-2B8hpujh0hTgQljRGId4Dg-3D-3DXEx5_EU3W9teASMK00lBXX9WT4lsogDrkCcNZLvg-2FVxwAXMpqJ0-2Bfnv2-2FSXUlg52TUkS4uxSk3QPG8iWcXRzrk-2B9RKzEXdImy7vPVPfobCitkPqycfORs5dqm5DRNtKzDWMe2v8pZfERgB4abKyzpcD14thNAda8IeCRimcHZTHa1TrkAIwnda90httchtDZlqlkvbTydvDbLO0dR2nGlQejj4Q-3D-3D" rel="noreferrer noreferrer" target="_blank">https://u15810271.ct.sendgrid.net/ls/click?upn=HRESupC-2F2Czv4BOaCWWCy7my0P0qcxCbhZ31OYv50ypUUzi-2FdSNmuyRB7BEFT8xQ4-2B8hpujh0hTgQljRGId4Dg-3D-3DXEx5_EU3W9teASMK00lBXX9WT4lsogDrkCcNZLvg-2FVxwAXMpqJ0-2Bfnv2-2FSXUlg52TUkS4uxSk3QPG8iWcXRzrk-2B9RKzEXdImy7vPVPfobCitkPqycfORs5dqm5DRNtKzDWMe2v8pZfERgB4abKyzpcD14thNAda8IeCRimcHZTHa1TrkAIwnda90httchtDZlqlkvbTydvDbLO0dR2nGlQejj4Q-3D-3D</a><br>
<br>
_______________________________________________<br>
build mailing list<br>
<a href="mailto:build@rtems.org" target="_blank" rel="noreferrer">build@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/build" rel="noreferrer noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/build</a><br>
</div>