summaryrefslogtreecommitdiffstats
path: root/src/udev/dmi_memory_id
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2020-12-18 10:47:44 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2020-12-18 15:13:21 +0100
commit3693cbacf79fd450acb3f3d22574122d576995ca (patch)
tree3d11517f8e3bd725ff064d7d36772a3f6994cbfe /src/udev/dmi_memory_id
parentMerge pull request #15531 from felipeborges/add-device-model-field-to-hostnamed (diff)
downloadsystemd-3693cbacf79fd450acb3f3d22574122d576995ca.tar.xz
systemd-3693cbacf79fd450acb3f3d22574122d576995ca.zip
memory-id: fix never hit condition
As sizeof(int64_t) is always 8.
Diffstat (limited to 'src/udev/dmi_memory_id')
-rw-r--r--src/udev/dmi_memory_id/dmi_memory_id.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/udev/dmi_memory_id/dmi_memory_id.c b/src/udev/dmi_memory_id/dmi_memory_id.c
index 5529daa602..c5bea8c9a8 100644
--- a/src/udev/dmi_memory_id/dmi_memory_id.c
+++ b/src/udev/dmi_memory_id/dmi_memory_id.c
@@ -602,8 +602,11 @@ static int smbios3_decode(const uint8_t *buf, const char *devmem, bool no_file_o
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to verify checksum.");
offset = QWORD(buf + 0x10);
- if (!no_file_offset && (offset >> 32) != 0 && sizeof(int64_t) < 8)
- return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "64-bit addresses not supported.");
+
+#if __SIZEOF_SIZE_T__ != 8
+ if (!no_file_offset && (offset >> 32) != 0)
+ return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "64-bit addresses not supported on 32-bit systems.");
+#endif
return dmi_table(offset, DWORD(buf + 0x0C), 0, devmem, no_file_offset);
}