]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
hwclock: avoid dereferencing a pointer [coverity scan]
authorKarel Zak <kzak@redhat.com>
Wed, 12 Mar 2025 14:34:17 +0000 (15:34 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 17 Mar 2025 11:21:53 +0000 (12:21 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
(cherry picked from commit 16c1d8734847bdeac0e6650a7364e33fb881bfc6)

sys-utils/hwclock-rtc.c

index e1ee6a05d13d78cfcd34c56a771f77e12d064378..f7d766f2c6536c7f4253eba783ac1337a85c4ffe 100644 (file)
@@ -431,6 +431,9 @@ static int resolve_rtc_param_alias(const char *alias, __u64 *value)
 {
        const struct hwclock_param *param = &hwclock_params[0];
 
+       if (!alias)
+               return 1;
+
        while (param->name) {
                if (!strcmp(alias, param->name)) {
                        *value = param->id;