]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - include/linux/idr.h
idr: Fix integer overflow in idr_for_each_entry
[mirror_ubuntu-bionic-kernel.git] / include / linux / idr.h
index fa14f834e4ede3a81e7e6182c889fec338b2495f..51adb0b8dbc74234f8497b6a369a93665d3c5b47 100644 (file)
@@ -206,7 +206,7 @@ static inline void *idr_find(const struct idr *idr, int id)
  * is convenient for a "not found" value.
  */
 #define idr_for_each_entry(idr, entry, id)                     \
-       for (id = 0; ((entry) = idr_get_next(idr, &(id))) != NULL; ++id)
+       for (id = 0; ((entry) = idr_get_next(idr, &(id))) != NULL; id += 1U)
 #define idr_for_each_entry_ext(idr, entry, id)                 \
        for (id = 0; ((entry) = idr_get_next_ext(idr, &(id))) != NULL; ++id)