]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-device: use size_t for index in the loop 18377/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 26 Jan 2021 11:35:53 +0000 (20:35 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 26 Jan 2021 11:35:53 +0000 (20:35 +0900)
src/libsystemd/sd-device/device-private.c

index 9070dfbdd1144f2dcf889aa415391667e2ae7a64..47ea04921e5748a6bb126d1629438cb3e313ff50 100644 (file)
@@ -448,7 +448,6 @@ int device_new_from_strv(sd_device **ret, char **strv) {
 int device_new_from_nulstr(sd_device **ret, uint8_t *nulstr, size_t len) {
         _cleanup_(sd_device_unrefp) sd_device *device = NULL;
         const char *major = NULL, *minor = NULL;
-        unsigned i = 0;
         int r;
 
         assert(ret);
@@ -459,11 +458,11 @@ int device_new_from_nulstr(sd_device **ret, uint8_t *nulstr, size_t len) {
         if (r < 0)
                 return r;
 
-        while (i < len) {
+        for (size_t i = 0; i < len; ) {
                 char *key;
                 const char *end;
 
-                key = (char*)&nulstr[i];
+                key = (char*) &nulstr[i];
                 end = memchr(key, '\0', len - i);
                 if (!end)
                         return log_device_debug_errno(device, SYNTHETIC_ERRNO(EINVAL),