#640 closed defect (fixed)
Analyze errors from llvm scan-build
Reported by: | Alex Samorukov | Owned by: | Christian Franke |
---|---|---|---|
Priority: | minor | Milestone: | Release 6.5 |
Component: | all | Version: | 6.4 |
Keywords: | Cc: |
Description
I tried to run clang scan-build tool and it produced a report. It seems that at least some of the warnings are real.
Change History (5)
comment:1 by , 9 years ago
Owner: | set to |
---|---|
Status: | new → accepted |
Type: | task → defect |
comment:2 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
comment:3 by , 9 years ago
btw, as far as i could see from the logic 5 could happens if we have ATA controller w/o any devices on it (n wont increment). So i think something like that should be better:
-
os_freebsd.cpp
1596 1596 n++; 1597 1597 }; 1598 1598 }; 1599 }; 1600 mp = (char **)reallocf(mp,n*(sizeof (char*))); // shrink to correct size 1599 }; 1600 if (n != 0) { 1601 mp = (char **)reallocf(mp,n*(sizeof (char*))); // shrink to correct size 1602 } 1603 else { 1604 goto end; 1605 } 1601 1606 if (mp == NULL && n > 0 ) { // reallocf never fail for size=0, but may return NULL 1602 1607 serrno=errno; 1603 1608 pout("Out of memory constructing scan device list (on line %d)\n", __LINE__);
comment:4 by , 9 years ago
The n > 0
check and comment following the reallocf() are no longer needed then. Probably better:
-
os_freebsd.cpp
1597 1597 }; 1598 1598 }; 1599 1599 }; 1600 if (n <= 0) 1601 goto end; 1600 1602 mp = (char **)reallocf(mp,n*(sizeof (char*))); // shrink to correct size 1601 if (mp == NULL && n > 0 ) { // reallocf never fail for size=0, but may return NULL1603 if (mp == NULL) { 1602 1604 serrno=errno; 1603 1605 pout("Out of memory constructing scan device list (on line %d)\n", __LINE__); 1604 1606 n = -1;
(blind patch, I don't have a FreeBSD VM available here ...)
Note:
See TracTickets
for help on using tickets.
5 of 6 fixed in r4206, r4207, r4208, r4209.
1: cosmetic (r4208)
2: cosmetic (r4207)
3: longstanding crash bug in smartd.conf parser (r4206)
4: harmless bug (r4209)
5: false positive (no workaround for now)
6: harmless bug (r4207)