libsystemd-network: make check-pointer-deref clean
Add the needed assert changes to make the code clean for the new check-pointer-deref script.
This commit is contained in:
@@ -2982,7 +2982,6 @@ if spatch.found()
|
||||
'src/import/',
|
||||
'src/journal/',
|
||||
'src/libsystemd/',
|
||||
'src/libsystemd-network/',
|
||||
'src/network/',
|
||||
'src/nspawn/',
|
||||
'src/nss-systemd/',
|
||||
|
||||
@@ -250,6 +250,8 @@ int dhcp6_option_append(
|
||||
|
||||
int r;
|
||||
|
||||
assert(buf);
|
||||
assert(offset);
|
||||
assert(optval || optlen == 0);
|
||||
|
||||
r = option_append_hdr(buf, offset, code, optlen);
|
||||
|
||||
@@ -408,6 +408,7 @@ static int format_mac_address(const void *data, size_t sz, char **ret) {
|
||||
char *k;
|
||||
|
||||
assert(data || sz <= 0);
|
||||
assert(ret);
|
||||
|
||||
if (sz != 7)
|
||||
return 0;
|
||||
|
||||
@@ -776,6 +776,9 @@ static usec_t client_compute_reacquisition_timeout(usec_t now_usec, usec_t expir
|
||||
}
|
||||
|
||||
static int cmp_uint8(const uint8_t *a, const uint8_t *b) {
|
||||
assert(a);
|
||||
assert(b);
|
||||
|
||||
return CMP(*a, *b);
|
||||
}
|
||||
|
||||
|
||||
@@ -1266,6 +1266,8 @@ int dhcp_lease_insert_private_option(sd_dhcp_lease *lease, uint8_t tag, const vo
|
||||
int dhcp_lease_new(sd_dhcp_lease **ret) {
|
||||
sd_dhcp_lease *lease;
|
||||
|
||||
assert(ret);
|
||||
|
||||
lease = new0(sd_dhcp_lease, 1);
|
||||
if (!lease)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -1641,6 +1641,7 @@ int sd_dhcp_server_set_callback(sd_dhcp_server *server, sd_dhcp_server_callback_
|
||||
|
||||
int sd_dhcp_server_set_relay_target(sd_dhcp_server *server, const struct in_addr *address) {
|
||||
assert_return(server, -EINVAL);
|
||||
assert_return(address, -EINVAL);
|
||||
assert_return(!sd_dhcp_server_is_running(server), -EBUSY);
|
||||
|
||||
if (memcmp(address, &server->relay_target, sizeof(struct in_addr)) == 0)
|
||||
|
||||
@@ -379,6 +379,9 @@ int sd_dhcp6_client_get_information_request(sd_dhcp6_client *client, int *enable
|
||||
}
|
||||
|
||||
static int be16_compare_func(const be16_t *a, const be16_t *b) {
|
||||
assert(a);
|
||||
assert(b);
|
||||
|
||||
return CMP(be16toh(*a), be16toh(*b));
|
||||
}
|
||||
|
||||
|
||||
@@ -157,6 +157,7 @@ int sd_lldp_tx_set_multicast_mode(sd_lldp_tx *lldp_tx, sd_lldp_multicast_mode_t
|
||||
|
||||
int sd_lldp_tx_set_hwaddr(sd_lldp_tx *lldp_tx, const struct ether_addr *hwaddr) {
|
||||
assert_return(lldp_tx, -EINVAL);
|
||||
assert_return(hwaddr, -EINVAL);
|
||||
assert_return(!ether_addr_is_null(hwaddr), -EINVAL);
|
||||
|
||||
lldp_tx->hwaddr = *hwaddr;
|
||||
|
||||
@@ -120,6 +120,9 @@ static DHCPMessage *create_message(uint8_t *options, uint16_t optlen,
|
||||
}
|
||||
|
||||
static void test_ignore_opts(uint8_t *descoption, int *descpos, int *desclen) {
|
||||
assert(descoption);
|
||||
assert(descpos);
|
||||
assert(desclen);
|
||||
assert_se(*descpos >= 0);
|
||||
|
||||
while (*descpos < *desclen) {
|
||||
|
||||
@@ -35,6 +35,8 @@ static void lldp_rx_handler(sd_lldp_rx *lldp_rx, sd_lldp_rx_event_t event, sd_ll
|
||||
static int start_lldp_rx(sd_lldp_rx **lldp_rx, sd_event *e, sd_lldp_rx_callback_t cb, void *cb_data) {
|
||||
int r;
|
||||
|
||||
assert(lldp_rx);
|
||||
|
||||
r = sd_lldp_rx_new(lldp_rx);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
Reference in New Issue
Block a user