]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libfdisk: gpt: drop pointless unsigned >= 0 check
authorJamie Magee <jamie.magee@gmail.com>
Mon, 4 May 2026 16:00:55 +0000 (09:00 -0700)
committerJamie Magee <jamie.magee@gmail.com>
Mon, 4 May 2026 16:00:55 +0000 (09:00 -0700)
GPT_ATTRBIT_REQ is 0 and val is uint16_t, so 'val >= GPT_ATTRBIT_REQ' is always true. CodeQL flagged it; keep only the upper bound.

libfdisk/src/gpt.c

index 2511361f656dcd068ff0ca4ea393c208a378b246..ee6e206c35d0cd66d1535ceaeadd30be3036aa19 100644 (file)
@@ -1878,8 +1878,7 @@ static int gpt_entry_attrs_from_string(
                                         && val < GPT_ATTRBIT_GUID_FIRST + GPT_ATTRBIT_GUID_COUNT) {
                                        bit = val;
                                        p = num_end;
-                               } else if (!is_guid && val >= GPT_ATTRBIT_REQ
-                                          && val <= GPT_ATTRBIT_LEGACY) {
+                               } else if (!is_guid && val <= GPT_ATTRBIT_LEGACY) {
                                        bit = val;
                                        p = num_end;
                                } else