]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/basic/io-util.c
tree-wide: use ASSERT_PTR more
[thirdparty/systemd.git] / src / basic / io-util.c
index a591a75c3741ad70afc5050bad593271059eb90a..cdad939aa68a7df55bc41db72aa6c379eb488e93 100644 (file)
@@ -49,11 +49,10 @@ int flush_fd(int fd) {
 }
 
 ssize_t loop_read(int fd, void *buf, size_t nbytes, bool do_poll) {
-        uint8_t *p = buf;
+        uint8_t *p = ASSERT_PTR(buf);
         ssize_t n = 0;
 
         assert(fd >= 0);
-        assert(buf);
 
         /* If called with nbytes == 0, let's call read() at least
          * once, to validate the operation */
@@ -108,10 +107,9 @@ int loop_read_exact(int fd, void *buf, size_t nbytes, bool do_poll) {
 }
 
 int loop_write(int fd, const void *buf, size_t nbytes, bool do_poll) {
-        const uint8_t *p = buf;
+        const uint8_t *p = ASSERT_PTR(buf);
 
         assert(fd >= 0);
-        assert(buf);
 
         if (_unlikely_(nbytes > (size_t) SSIZE_MAX))
                 return -EINVAL;