libblkid: remove unnecessary position check from list_for_each_safe loops
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>
This commit is contained in:
parent
b94fecf587
commit
b29a641219
|
@ -217,8 +217,6 @@ void blkid_gc_cache(blkid_cache cache)
|
|||
|
||||
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));
|
||||
|
|
|
@ -91,10 +91,7 @@ blkid_dev blkid_get_dev(blkid_cache cache, const char *devname, int flags)
|
|||
* 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 ||
|
||||
|
|
Loading…
Reference in New Issue