The position pointer is dereferenced before the check in the
for() in the list_for_each_safe macro.
Note that struct list_head should not contain NULL pointers. See
INIT_LIST_HEAD() macro.
Signed-off-by: Karel Zak <kzak@redhat.com>
list_for_each_safe(p, pnext, &cache->bic_devs) {
blkid_dev dev = list_entry(p, struct blkid_struct_dev, bid_devs);
- if (!p)
- break;
if (stat(dev->bid_name, &st) < 0) {
DBG(DEBUG_CACHE,
printf("freeing %s\n", dev->bid_name));
* it.
*/
list_for_each_safe(p, pnext, &cache->bic_devs) {
- blkid_dev dev2;
- if (!p)
- break;
- dev2 = list_entry(p, struct blkid_struct_dev, bid_devs);
+ blkid_dev dev2 = list_entry(p, struct blkid_struct_dev, bid_devs);
if (dev2->bid_flags & BLKID_BID_FL_VERIFIED)
continue;
if (!dev->bid_type || !dev2->bid_type ||