/systemd-251/src/basic/ |
D | strxcpyx.c | 21 size_t strnpcpy_full(char **dest, size_t size, const char *src, size_t len, bool *ret_truncated) { in strnpcpy_full() argument 27 if (size == 0) { in strnpcpy_full() 33 if (len >= size) { in strnpcpy_full() 34 if (size > 1) in strnpcpy_full() 35 *dest = mempcpy(*dest, src, size-1); in strnpcpy_full() 36 size = 0; in strnpcpy_full() 40 size -= len; in strnpcpy_full() 47 return size; in strnpcpy_full() 50 size_t strpcpy_full(char **dest, size_t size, const char *src, bool *ret_truncated) { in strpcpy_full() argument 54 return strnpcpy_full(dest, size, src, strlen(src), ret_truncated); in strpcpy_full() [all …]
|
D | strxcpyx.h | 9 size_t strnpcpy_full(char **dest, size_t size, const char *src, size_t len, bool *ret_truncated); 10 static inline size_t strnpcpy(char **dest, size_t size, const char *src, size_t len) { in strnpcpy() argument 11 return strnpcpy_full(dest, size, src, len, NULL); in strnpcpy() 13 size_t strpcpy_full(char **dest, size_t size, const char *src, bool *ret_truncated); 14 static inline size_t strpcpy(char **dest, size_t size, const char *src) { in strpcpy() argument 15 return strpcpy_full(dest, size, src, NULL); in strpcpy() 17 size_t strpcpyf_full(char **dest, size_t size, bool *ret_truncated, const char *src, ...) _printf_(… 18 #define strpcpyf(dest, size, src, ...) \ argument 19 strpcpyf_full((dest), (size), NULL, (src), ##__VA_ARGS__) 20 size_t strpcpyl_full(char **dest, size_t size, bool *ret_truncated, const char *src, ...) _sentinel… [all …]
|
D | alloc-util.h | 96 static inline bool size_multiply_overflow(size_t size, size_t need) { in size_multiply_overflow() argument 97 return _unlikely_(need != 0 && size > (SIZE_MAX / need)); in size_multiply_overflow() 100 _malloc_ _alloc_(1, 2) static inline void *malloc_multiply(size_t size, size_t need) { in malloc_multiply() argument 101 if (size_multiply_overflow(size, need)) in malloc_multiply() 104 return malloc(size * need ?: 1); in malloc_multiply() 108 _alloc_(2, 3) static inline void *reallocarray(void *p, size_t need, size_t size) { in reallocarray() argument 109 if (size_multiply_overflow(size, need)) in reallocarray() 112 return realloc(p, size * need ?: 1); in reallocarray() 116 _alloc_(2, 3) static inline void *memdup_multiply(const void *p, size_t size, size_t need) { in memdup_multiply() argument 117 if (size_multiply_overflow(size, need)) in memdup_multiply() [all …]
|
D | alloc-util.c | 44 size_t size) { in greedy_realloc() argument 56 if (*p && (size == 0 || (MALLOC_SIZEOF_SAFE(*p) / size >= need))) in greedy_realloc() 63 if (size_multiply_overflow(newalloc, size)) in greedy_realloc() 65 a = newalloc * size; in greedy_realloc() 80 size_t size) { in greedy_realloc0() argument 89 q = greedy_realloc(p, need, size); in greedy_realloc0() 95 if (size == 0) /* avoid division by zero */ in greedy_realloc0() 98 before = (before / size) * size; /* Round down */ in greedy_realloc0()
|
D | compress.c | 231 int r, size; /* LZ4 uses int for size */ in decompress_blob_lz4() local 241 size = unaligned_read_le64(src); in decompress_blob_lz4() 242 if (size < 0 || (unsigned) size != unaligned_read_le64(src)) in decompress_blob_lz4() 244 out = greedy_realloc(dst, size, 1); in decompress_blob_lz4() 248 r = LZ4_decompress_safe((char*)src + 8, out, src_size - 8, size); in decompress_blob_lz4() 249 if (r < 0 || r != size) in decompress_blob_lz4() 252 *dst_size = size; in decompress_blob_lz4() 267 uint64_t size; in decompress_blob_zstd() local 274 size = ZSTD_getFrameContentSize(src, src_size); in decompress_blob_zstd() 275 if (IN_SET(size, ZSTD_CONTENTSIZE_ERROR, ZSTD_CONTENTSIZE_UNKNOWN)) in decompress_blob_zstd() [all …]
|
/systemd-251/src/libsystemd-network/ |
D | network-internal.c | 19 size_t size, in serialize_in_addrs() argument 30 for (size_t i = 0; i < size; i++) { in serialize_in_addrs() 48 int size = 0; in deserialize_in_addrs() local 64 new_addresses = reallocarray(addresses, size + 1, sizeof(struct in_addr)); in deserialize_in_addrs() 70 r = inet_pton(AF_INET, word, &(addresses[size])); in deserialize_in_addrs() 74 size++; in deserialize_in_addrs() 77 *ret = size > 0 ? TAKE_PTR(addresses) : NULL; in deserialize_in_addrs() 79 return size; in deserialize_in_addrs() 82 void serialize_in6_addrs(FILE *f, const struct in6_addr *addresses, size_t size, bool *with_leading… in serialize_in6_addrs() argument 85 assert(size); in serialize_in6_addrs() [all …]
|
D | dhcp-option.c | 18 static int dhcp_option_append_tlv(uint8_t options[], size_t size, size_t *offset, uint8_t code, siz… in dhcp_option_append_tlv() argument 20 assert(size > 0); in dhcp_option_append_tlv() 23 assert(*offset < size); in dhcp_option_append_tlv() 25 if (*offset + 2 + optlen > size) in dhcp_option_append_tlv() 36 static int option_append(uint8_t options[], size_t size, size_t *offset, in option_append() argument 39 assert(size > 0); in option_append() 46 size--; in option_append() 52 if (*offset + 1 > size) in option_append() 74 if (*offset + 2 + total > size) in option_append() 92 if (*offset + 3 + optlen > size) in option_append() [all …]
|
D | fuzz-dhcp6-client.c | 24 static void fuzz_client(sd_dhcp6_client *client, const uint8_t *data, size_t size, DHCP6State state… in fuzz_client() argument 30 if (size >= sizeof(DHCP6Message)) in fuzz_client() 37 assert_se(write(test_dhcp_fd[1], data, size) == (ssize_t) size); in fuzz_client() 68 int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { in LLVMFuzzerTestOneInput() argument 76 if (outside_size_range(size, 0, 65536)) in LLVMFuzzerTestOneInput() 97 fuzz_client(client, data, size, DHCP6_STATE_INFORMATION_REQUEST); in LLVMFuzzerTestOneInput() 98 fuzz_client(client, data, size, DHCP6_STATE_SOLICITATION); in LLVMFuzzerTestOneInput() 102 if (size == 0) in LLVMFuzzerTestOneInput() 105 fuzz_client(client, data, size, DHCP6_STATE_REQUEST); in LLVMFuzzerTestOneInput()
|
/systemd-251/src/journal-remote/ |
D | journal-upload-journal.c | 19 static ssize_t write_entry(char *buf, size_t size, Uploader *u) { in write_entry() argument 23 assert(size <= SSIZE_MAX); in write_entry() 35 r = snprintf(buf + pos, size - pos, in write_entry() 38 if ((size_t) r > size - pos) in write_entry() 44 if (pos + r == size) { in write_entry() 46 buf[size - 1] = '\n'; in write_entry() 47 return size; in write_entry() 60 r = snprintf(buf + pos, size - pos, in write_entry() 63 if ((size_t) r > size - pos) in write_entry() 69 if (r + pos == size) { in write_entry() [all …]
|
/systemd-251/src/boot/efi/ |
D | random-seed.c | 20 static EFI_STATUS acquire_rng(UINTN size, void **ret) { in acquire_rng() argument 35 data = xallocate_pool(size); in acquire_rng() 37 err = rng->GetRNG(rng, NULL, size, data); in acquire_rng() 48 UINTN size, in hash_once() argument 70 sha256_process_bytes(old_seed, size, &hash); in hash_once() 72 sha256_process_bytes(rng, size, &hash); in hash_once() 82 UINTN size, in hash_many() argument 101 hash_once(old_seed, rng, size, in hash_many() 113 UINTN size, in mangle_random_seed() argument 134 n = (size + HASH_VALUE_SIZE - 1) / HASH_VALUE_SIZE; in mangle_random_seed() [all …]
|
D | util.c | 38 EFI_STATUS efivar_set_raw(const EFI_GUID *vendor, const CHAR16 *name, const void *buf, UINTN size, … in efivar_set_raw() argument 41 assert(buf || size == 0); in efivar_set_raw() 44 return RT->SetVariable((CHAR16 *) name, (EFI_GUID *) vendor, flags, size, (void *) buf); in efivar_set_raw() 103 UINTN size; in efivar_get() local 108 err = efivar_get_raw(vendor, name, (CHAR8**)&buf, &size); in efivar_get() 113 if ((size % sizeof(CHAR16)) != 0) in efivar_get() 120 if (size >= sizeof(CHAR16) && buf[size / sizeof(CHAR16) - 1] == 0) { in efivar_get() 126 val = xallocate_pool(size + sizeof(CHAR16)); in efivar_get() 128 CopyMem(val, buf, size); in efivar_get() 129 val[size / sizeof(CHAR16) - 1] = 0; /* NUL terminate */ in efivar_get() [all …]
|
/systemd-251/src/libsystemd/sd-netlink/ |
D | netlink-types-rtnl.c | 66 [IFLA_BATADV_ALGO_NAME] = { .type = NETLINK_TYPE_STRING, .size = 20 }, 95 [IFLA_BOND_AD_INFO_PARTNER_MAC] = { .type = NETLINK_TYPE_ETHER_ADDR, .size = ETH_ALEN }, 126 [IFLA_BOND_AD_ACTOR_SYSTEM] = { .type = NETLINK_TYPE_ETHER_ADDR, .size = ETH_ALEN }, 141 …[IFLA_BR_ROOT_ID] = { .type = NETLINK_TYPE_BINARY, .size = sizeof(struct ifla_b… 142 …[IFLA_BR_BRIDGE_ID] = { .type = NETLINK_TYPE_BINARY, .size = sizeof(struct ifla_b… 151 … [IFLA_BR_GROUP_ADDR] = { .type = NETLINK_TYPE_ETHER_ADDR, .size = ETH_ALEN }, 176 …[IFLA_BR_MULTI_BOOLOPT] = { .type = NETLINK_TYPE_BINARY, .size = sizeof(struct br_boo… 180 …[IFLA_CAN_BITTIMING] = { .type = NETLINK_TYPE_BINARY, .size = sizeof(struct can_bittimi… 181 …[IFLA_CAN_BITTIMING_CONST] = { .type = NETLINK_TYPE_BINARY, .size = sizeof(struct can_bittimi… 182 …[IFLA_CAN_CLOCK] = { .type = NETLINK_TYPE_BINARY, .size = sizeof(struct can_clock) … [all …]
|
D | netlink-types-nfnl.c | 13 [NFTA_TABLE_NAME] = { .type = NETLINK_TYPE_STRING, .size = NFT_TABLE_MAXNAMELEN - 1 }, 22 [NFTA_HOOK_DEV] = { .type = NETLINK_TYPE_STRING, .size = IFNAMSIZ - 1 }, 28 [NFTA_CHAIN_TABLE] = { .type = NETLINK_TYPE_STRING, .size = NFT_TABLE_MAXNAMELEN - 1 }, 29 [NFTA_CHAIN_NAME] = { .type = NETLINK_TYPE_STRING, .size = NFT_TABLE_MAXNAMELEN - 1 }, 31 [NFTA_CHAIN_TYPE] = { .type = NETLINK_TYPE_STRING, .size = 16 }, 113 [NFTA_EXPR_NAME] = { .type = NETLINK_TYPE_STRING, .size = 16 }, 120 [NFTA_RULE_TABLE] = { .type = NETLINK_TYPE_STRING, .size = NFT_TABLE_MAXNAMELEN - 1 }, 121 [NFTA_RULE_CHAIN] = { .type = NETLINK_TYPE_STRING, .size = NFT_TABLE_MAXNAMELEN - 1 }, 128 [NFTA_SET_TABLE] = { .type = NETLINK_TYPE_STRING, .size = NFT_TABLE_MAXNAMELEN - 1 }, 129 [NFTA_SET_NAME] = { .type = NETLINK_TYPE_STRING, .size = NFT_TABLE_MAXNAMELEN - 1 }, [all …]
|
D | netlink-types-genl.c | 53 … [BATADV_ATTR_MESH_IFNAME] = { .type = NETLINK_TYPE_STRING, .size = IFNAMSIZ }, 54 …[BATADV_ATTR_MESH_ADDRESS] = { .type = NETLINK_TYPE_ETHER_ADDR, .size = ETH_ALEN … 56 … [BATADV_ATTR_HARD_IFNAME] = { .type = NETLINK_TYPE_STRING, .size = IFNAMSIZ }, 57 …[BATADV_ATTR_HARD_ADDRESS] = { .type = NETLINK_TYPE_ETHER_ADDR, .size = ETH_ALEN … 58 …[BATADV_ATTR_ORIG_ADDRESS] = { .type = NETLINK_TYPE_ETHER_ADDR, .size = ETH_ALEN … 65 …[BATADV_ATTR_TT_ADDRESS] = { .type = NETLINK_TYPE_ETHER_ADDR, .size = ETH_ALEN … 73 …[BATADV_ATTR_NEIGH_ADDRESS] = { .type = NETLINK_TYPE_ETHER_ADDR, .size = ETH_ALEN … 78 …[BATADV_ATTR_ROUTER] = { .type = NETLINK_TYPE_ETHER_ADDR, .size = ETH_ALEN … 80 …[BATADV_ATTR_BLA_ADDRESS] = { .type = NETLINK_TYPE_ETHER_ADDR, .size = ETH_ALEN … 82 …[BATADV_ATTR_BLA_BACKBONE] = { .type = NETLINK_TYPE_ETHER_ADDR, .size = ETH_ALEN … [all …]
|
/systemd-251/src/partition/ |
D | test-repart.sh | 25 "$repart" "$D/zzz" --empty=create --size=1G --seed="$SEED" --no-pager 72 $D/zzz1 : start= 2048, size= 591856, type=933AC7E1-2EB4-4F13-B844-0E14E2AEF915, uuid=A6… 73 $D/zzz2 : start= 593904, size= 591856, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709, uuid=CE… 74 $D/zzz3 : start= 1185760, size= 591864, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709, uuid=AC… 75 $D/zzz4 : start= 1777624, size= 131072, type=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F, uuid=2A… 107 $D/zzz1 : start= 2048, size= 591856, type=933AC7E1-2EB4-4F13-B844-0E14E2AEF915, uuid=A6… 108 $D/zzz2 : start= 593904, size= 591856, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709, uuid=CE… 109 $D/zzz3 : start= 1185760, size= 591864, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709, uuid=AC… 110 $D/zzz4 : start= 1777624, size= 131072, type=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F, uuid=2A… 111 $D/zzz5 : start= 1908696, size= 188416, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=A0… [all …]
|
D | growfs.c | 37 uint64_t size; in resize_crypt_luks_device() local 52 if (ioctl(main_devfd, BLKGETSIZE64, &size) != 0) in resize_crypt_luks_device() 56 log_debug("%s is %"PRIu64" bytes", main_devpath, size); in resize_crypt_luks_device() 78 if (ioctl(main_devfd, BLKGETSIZE64, &size) != 0) in resize_crypt_luks_device() 82 log_debug("%s is now %"PRIu64" bytes", main_devpath, size); in resize_crypt_luks_device() 200 uint64_t size, newsize; in run() local 240 if (ioctl(devfd, BLKGETSIZE64, &size) != 0) in run() 243 log_debug("Resizing \"%s\" to %"PRIu64" bytes...", arg_target, size); in run() 244 r = resize_fs(mountfd, size, &newsize); in run() 247 arg_target, size); in run() [all …]
|
/systemd-251/test/TEST-64-UDEV-STORAGE/ |
D | test.sh | 233 name="Hello world", size=2M 234 name="Hello world", size=2M 235 name="Hello world", size=2M 236 name="Hello world", size=2M 237 name="Hello world", size=2M 238 name="Hello world", size=2M 239 name="Hello world", size=2M 240 name="Hello world", size=2M 283 name="first_partition", size=5M 284 uuid="deadbeef-dead-dead-beef-000000000000", name="failover_part", size=5M [all …]
|
/systemd-251/src/libsystemd/sd-journal/ |
D | mmap-cache.c | 30 size_t size; member 93 munmap(w->ptr, w->size); in window_unlink() 123 …assert_se(mmap(w->ptr, w->size, w->fd->prot, MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED, -1, 0) == w->ptr… in window_invalidate() 135 _pure_ static bool window_matches(Window *w, uint64_t offset, size_t size) { in window_matches() argument 137 assert(size > 0); in window_matches() 141 offset + size <= w->offset + w->size; in window_matches() 144 _pure_ static bool window_matches_fd(Window *w, MMapFileDescriptor *f, uint64_t offset, size_t size… in window_matches_fd() argument 150 window_matches(w, offset, size); in window_matches_fd() 153 …d(MMapCache *m, MMapFileDescriptor *f, bool keep_always, uint64_t offset, size_t size, void *ptr) { in window_add() argument 178 .size = size, in window_add() [all …]
|
/systemd-251/src/test/ |
D | test-compress-benchmark.c | 92 size_t j = 0, k = 0, size; in test_compress_decompress() local 95 size = permute(i); in test_compress_decompress() 96 if (size == 0) in test_compress_decompress() 99 log_debug("%s %zu %zu", type, i, size); in test_compress_decompress() 101 memzero(buf, MIN(size + 1000, MAX_SIZE)); in test_compress_decompress() 103 r = compress(text, size, buf, size, &j); in test_compress_decompress() 105 assert_se(r > 0 || (size < 2048 && r == -ENOBUFS) || streq(type, "random")); in test_compress_decompress() 108 assert_se(buf[size] == 0); in test_compress_decompress() 110 skipped += size; in test_compress_decompress() 115 if (j >= size) in test_compress_decompress() [all …]
|
/systemd-251/src/shared/ |
D | data-fd-util.c | 23 int acquire_data_fd(const void *data, size_t size, unsigned flags) { in acquire_data_fd() argument 31 assert(data || size == 0); in acquire_data_fd() 52 if (size == 0 && ((flags & ACQUIRE_NO_DEV_NULL) == 0)) in acquire_data_fd() 61 n = write(fd, data, size); in acquire_data_fd() 64 if ((size_t) n != size) in acquire_data_fd() 87 if ((size_t) isz < size) { in acquire_data_fd() 88 isz = (int) size; in acquire_data_fd() 89 if (isz < 0 || (size_t) isz != size) in acquire_data_fd() 100 if ((size_t) isz < size) in acquire_data_fd() 104 n = write(pipefds[1], data, size); in acquire_data_fd() [all …]
|
/systemd-251/src/resolve/ |
D | fuzz-dns-packet.c | 7 int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { in LLVMFuzzerTestOneInput() argument 10 if (outside_size_range(size, 0, DNS_PACKET_SIZE_MAX)) in LLVMFuzzerTestOneInput() 14 p->size = 0; /* by default append starts after the header, undo that */ in LLVMFuzzerTestOneInput() 15 assert_se(dns_packet_append_blob(p, data, size, NULL) >= 0); in LLVMFuzzerTestOneInput() 16 if (size < DNS_PACKET_HEADER_SIZE) { in LLVMFuzzerTestOneInput() 19 memzero(DNS_PACKET_DATA(p) + size, DNS_PACKET_HEADER_SIZE - size); in LLVMFuzzerTestOneInput() 20 p->size = DNS_PACKET_HEADER_SIZE; in LLVMFuzzerTestOneInput()
|
D | resolved-dns-packet.c | 84 .size = DNS_PACKET_HEADER_SIZE, in dns_packet_new() 177 c = malloc(ALIGN(sizeof(DnsPacket)) + p->size); in dns_packet_dup() 184 .size = p->size, in dns_packet_dup() 186 .allocated = p->size, in dns_packet_dup() 192 memcpy(DNS_PACKET_DATA(c), DNS_PACKET_DATA(p), p->size); in dns_packet_dup() 248 if (p->size < DNS_PACKET_HEADER_SIZE) in dns_packet_validate() 251 if (p->size > DNS_PACKET_SIZE_MAX) in dns_packet_validate() 350 if (p->size + add > p->allocated) { in dns_packet_extend() 353 a = PAGE_ALIGN((p->size + add) * 2); in dns_packet_extend() 359 if (p->size + add > a) in dns_packet_extend() [all …]
|
/systemd-251/src/sysupdate/ |
D | sysupdate-cache.c | 26 size_t size) { in web_cache_add_item() argument 34 assert(data || size == 0); in web_cache_add_item() 36 if (size > WEB_CACHE_ITEM_SIZE_MAX) in web_cache_add_item() 40 if (item && memcmp_nn(item->data, item->size, data, size) == 0) in web_cache_add_item() 54 item = malloc(offsetof(WebCacheItem, data) + size + 1); in web_cache_add_item() 60 .size = size, in web_cache_add_item() 65 *(uint8_t*) mempcpy(item->data, data, size) = 0; in web_cache_add_item()
|
/systemd-251/src/fuzz/ |
D | fuzz.h | 11 int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size); 13 static inline FILE* data_to_file(const uint8_t *data, size_t size) { in data_to_file() argument 14 if (size == 0) in data_to_file() 17 return fmemopen_unlocked((char*) data, size, "re"); in data_to_file() 23 static inline bool outside_size_range(size_t size, size_t lower, size_t upper) { in outside_size_range() argument 24 if (size < lower) in outside_size_range() 26 if (size > upper) in outside_size_range()
|
/systemd-251/src/import/ |
D | import-compress.c | 29 int import_uncompress_detect(ImportCompress *c, const void *data, size_t size) { in import_uncompress_detect() argument 47 if (size < MAX3(sizeof(xz_signature), in import_uncompress_detect() 93 int import_uncompress(ImportCompress *c, const void *data, size_t size, ImportCompressCallback call… in import_uncompress() argument 99 r = import_uncompress_detect(c, data, size); in import_uncompress() 106 if (size <= 0) in import_uncompress() 114 r = callback(data, size, userdata); in import_uncompress() 122 c->xz.avail_in = size; in import_uncompress() 146 c->gzip.avail_in = size; in import_uncompress() 170 c->bzip2.avail_in = size; in import_uncompress() 265 int import_compress(ImportCompress *c, const void *data, size_t size, void **buffer, size_t *buffer… in import_compress() argument [all …]
|