From 977f65f01dadb501c6bd08990887eca655361e5e Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 25 Dec 2017 13:38:49 +0900 Subject: [PATCH] sd-boot, udev: trivial condition simplifications Reported and proposed by @dcb314. Fixes #7656 and #7657. --- src/boot/efi/boot.c | 2 +- src/udev/udev-builtin-net_id.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c index ea9f39a..06331da 100644 --- a/src/boot/efi/boot.c +++ b/src/boot/efi/boot.c @@ -166,7 +166,7 @@ static BOOLEAN line_edit(CHAR16 *line_in, CHAR16 **line_out, UINTN x_max, UINTN case KEYPRESS(EFI_ALT_PRESSED, 0, 'f'): case KEYPRESS(EFI_CONTROL_PRESSED, SCAN_RIGHT, 0): /* forward-word */ - while (line[first + cursor] && line[first + cursor] == ' ') + while (line[first + cursor] == ' ') cursor_right(&cursor, &first, x_max, len); while (line[first + cursor] && line[first + cursor] != ' ') cursor_right(&cursor, &first, x_max, len); diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c index f3be27f..945585d 100644 --- a/src/udev/udev-builtin-net_id.c +++ b/src/udev/udev-builtin-net_id.c @@ -547,7 +547,7 @@ static int names_ccw(struct udev_device *dev, struct netnames *names) { * verify each bus-ID part... */ bus_id_len = strlen(bus_id); - if (!bus_id_len || bus_id_len < 8 || bus_id_len > 9) + if (!IN_SET(bus_id_len, 8, 9)) return -EINVAL; /* Strip leading zeros from the bus id for aesthetic purposes. This -- 2.7.4