]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: sizeof() fixes
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 21 Nov 2025 08:25:18 +0000 (09:25 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 25 Nov 2025 16:34:48 +0000 (17:34 +0100)
- TIME_T_MAX is always time_t so the check in time-util.c was redundant
- quota-util.c was zero-ing a pointer
- smbios11.c was calling sizeof(pointer)

src/basic/time-util.c
src/shared/quota-util.c
src/shared/smbios11.c

index 62f1fcaed83379b16ebf5b78ba9ed3d262e24add..70fd5835c3f080022d667e9e63d70263c5ddb703 100644 (file)
@@ -1805,8 +1805,6 @@ int time_change_fd(void) {
 
         _cleanup_close_ int fd = -EBADF;
 
-        assert_cc(sizeof(time_t) == sizeof(TIME_T_MAX));
-
         /* Uses TFD_TIMER_CANCEL_ON_SET to get notifications whenever CLOCK_REALTIME makes a jump relative to
          * CLOCK_MONOTONIC. */
 
index 265d5029717ea513e994ba18576572abee7c615d..0a7d9bf38a97714c641d3babeffaade7e6f7c3e1 100644 (file)
@@ -42,7 +42,7 @@ int quota_query_proj_id(int fd, uint32_t proj_id, struct dqblk *ret_req) {
 
         r = quotactl_fd_with_fallback(fd, QCMD_FIXED(Q_GETQUOTA, PRJQUOTA), proj_id, ret_req);
         if (r == -ESRCH || ERRNO_IS_NEG_NOT_SUPPORTED(r) || ERRNO_IS_NEG_PRIVILEGE(r)) {
-                zero(ret_req);
+                *ret_req = (struct dqblk) {};
                 return false;
         }
         if (r < 0)
index 1c6968d21fcbf32fb0c72106c32bdbf8c9d33082..28cc29ee46872491038f804ffe9eafab874c2cf4 100644 (file)
@@ -40,7 +40,7 @@ int read_smbios11_field(unsigned i, size_t max_size, char **ret_data, size_t *re
                         AT_FDCWD, p,
                         /* offset = */ UINT64_MAX,
                         max_size >= SIZE_MAX - offsetof(struct dmi_field_header, contents) ? SIZE_MAX :
-                        sizeof(dmi_field_header) + max_size,
+                        sizeof(struct dmi_field_header) + max_size,
                         /* flags = */ 0,
                         /* bind_name = */ NULL,
                         (char**) &data, &size);