tree-wide: use ASSERT_PTR more
This commit is contained in:
@@ -157,7 +157,7 @@ int config_parse_ip_protocol(
|
||||
void *data,
|
||||
void *userdata) {
|
||||
|
||||
uint8_t *ret = data;
|
||||
uint8_t *ret = ASSERT_PTR(data);
|
||||
unsigned protocol;
|
||||
/* linux/fou.h defines the netlink field as one byte, so we need to reject protocols numbers that
|
||||
* don't fit in one byte. */
|
||||
@@ -167,7 +167,6 @@ int config_parse_ip_protocol(
|
||||
assert(section);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(data);
|
||||
|
||||
r = parse_ip_protocol(rvalue);
|
||||
if (r >= 0)
|
||||
@@ -204,14 +203,13 @@ int config_parse_fou_tunnel_address(
|
||||
void *data,
|
||||
void *userdata) {
|
||||
|
||||
union in_addr_union *addr = data;
|
||||
union in_addr_union *addr = ASSERT_PTR(data);
|
||||
FouTunnel *t = userdata;
|
||||
int r, *f;
|
||||
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(data);
|
||||
|
||||
if (streq(lvalue, "Local"))
|
||||
f = &t->local_family;
|
||||
|
||||
@@ -119,13 +119,12 @@ int config_parse_ipoib_pkey(
|
||||
void *data,
|
||||
void *userdata) {
|
||||
|
||||
uint16_t u, *pkey = data;
|
||||
uint16_t u, *pkey = ASSERT_PTR(data);
|
||||
int r;
|
||||
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(data);
|
||||
|
||||
if (isempty(rvalue)) {
|
||||
*pkey = 0; /* 0 means unset. */
|
||||
|
||||
@@ -481,15 +481,13 @@ int config_parse_l2tp_tunnel_local_address(
|
||||
|
||||
_cleanup_free_ char *addr_or_type = NULL, *ifname = NULL;
|
||||
L2tpLocalAddressType type;
|
||||
L2tpTunnel *t = userdata;
|
||||
const char *p = rvalue;
|
||||
L2tpTunnel *t = ASSERT_PTR(userdata);
|
||||
const char *p = ASSERT_PTR(rvalue);
|
||||
union in_addr_union a;
|
||||
int r, f;
|
||||
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(t);
|
||||
|
||||
if (isempty(rvalue)) {
|
||||
t->local_ifname = mfree(t->local_ifname);
|
||||
@@ -575,14 +573,13 @@ int config_parse_l2tp_tunnel_remote_address(
|
||||
void *data,
|
||||
void *userdata) {
|
||||
|
||||
L2tpTunnel *t = userdata;
|
||||
L2tpTunnel *t = ASSERT_PTR(userdata);
|
||||
union in_addr_union a;
|
||||
int r, f;
|
||||
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(t);
|
||||
|
||||
if (isempty(rvalue)) {
|
||||
t->remote = IN_ADDR_NULL;
|
||||
|
||||
@@ -84,7 +84,7 @@ int config_parse_macvlan_broadcast_queue_size(
|
||||
void *data,
|
||||
void *userdata) {
|
||||
|
||||
MacVlan *m = userdata;
|
||||
MacVlan *m = ASSERT_PTR(userdata);
|
||||
uint32_t v;
|
||||
int r;
|
||||
|
||||
@@ -93,7 +93,6 @@ int config_parse_macvlan_broadcast_queue_size(
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(data);
|
||||
assert(userdata);
|
||||
|
||||
if (isempty(rvalue)) {
|
||||
m->bc_queue_length = UINT32_MAX;
|
||||
|
||||
@@ -902,11 +902,10 @@ int config_parse_netdev_kind(
|
||||
void *data,
|
||||
void *userdata) {
|
||||
|
||||
NetDevKind k, *kind = data;
|
||||
NetDevKind k, *kind = ASSERT_PTR(data);
|
||||
|
||||
assert(filename);
|
||||
assert(rvalue);
|
||||
assert(data);
|
||||
|
||||
k = netdev_kind_from_string(rvalue);
|
||||
if (k < 0) {
|
||||
@@ -938,10 +937,9 @@ int config_parse_netdev_hw_addr(
|
||||
void *data,
|
||||
void *userdata) {
|
||||
|
||||
struct hw_addr_data *hw_addr = data;
|
||||
struct hw_addr_data *hw_addr = ASSERT_PTR(data);
|
||||
|
||||
assert(rvalue);
|
||||
assert(data);
|
||||
|
||||
if (streq(rvalue, "none")) {
|
||||
*hw_addr = HW_ADDR_NONE;
|
||||
|
||||
@@ -778,13 +778,12 @@ int config_parse_tunnel_local_address(
|
||||
|
||||
union in_addr_union buffer = IN_ADDR_NULL;
|
||||
NetDevLocalAddressType type;
|
||||
Tunnel *t = userdata;
|
||||
Tunnel *t = ASSERT_PTR(userdata);
|
||||
int r, f;
|
||||
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(userdata);
|
||||
|
||||
if (isempty(rvalue) || streq(rvalue, "any"))
|
||||
return unset_local(t);
|
||||
@@ -846,13 +845,12 @@ int config_parse_tunnel_remote_address(
|
||||
void *userdata) {
|
||||
|
||||
union in_addr_union buffer;
|
||||
Tunnel *t = userdata;
|
||||
Tunnel *t = ASSERT_PTR(userdata);
|
||||
int r, f;
|
||||
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(userdata);
|
||||
|
||||
if (isempty(rvalue) || streq(rvalue, "any"))
|
||||
return unset_remote(t);
|
||||
|
||||
@@ -129,13 +129,12 @@ int config_parse_vlan_qos_maps(
|
||||
void *data,
|
||||
void *userdata) {
|
||||
|
||||
Set **s = data;
|
||||
Set **s = ASSERT_PTR(data);
|
||||
int r;
|
||||
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(data);
|
||||
|
||||
if (isempty(rvalue)) {
|
||||
*s = set_free(*s);
|
||||
|
||||
@@ -207,7 +207,7 @@ int config_parse_vxlan_address(
|
||||
void *data,
|
||||
void *userdata) {
|
||||
|
||||
VxLan *v = userdata;
|
||||
VxLan *v = ASSERT_PTR(userdata);
|
||||
union in_addr_union *addr = data, buffer;
|
||||
int *family, f, r;
|
||||
|
||||
@@ -215,7 +215,6 @@ int config_parse_vxlan_address(
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(data);
|
||||
assert(userdata);
|
||||
|
||||
if (streq(lvalue, "Local"))
|
||||
family = &v->local_family;
|
||||
|
||||
@@ -296,10 +296,9 @@ static int wireguard_set_interface(NetDev *netdev) {
|
||||
}
|
||||
|
||||
static int on_resolve_retry(sd_event_source *s, usec_t usec, void *userdata) {
|
||||
WireguardPeer *peer = userdata;
|
||||
WireguardPeer *peer = ASSERT_PTR(userdata);
|
||||
NetDev *netdev;
|
||||
|
||||
assert(peer);
|
||||
assert(peer->wireguard);
|
||||
|
||||
netdev = NETDEV(peer->wireguard);
|
||||
@@ -332,11 +331,10 @@ static int wireguard_peer_resolve_handler(
|
||||
const struct addrinfo *ai,
|
||||
void *userdata) {
|
||||
|
||||
WireguardPeer *peer = userdata;
|
||||
WireguardPeer *peer = ASSERT_PTR(userdata);
|
||||
NetDev *netdev;
|
||||
int r;
|
||||
|
||||
assert(peer);
|
||||
assert(peer->wireguard);
|
||||
|
||||
netdev = NETDEV(peer->wireguard);
|
||||
@@ -462,11 +460,10 @@ int config_parse_wireguard_listen_port(
|
||||
void *data,
|
||||
void *userdata) {
|
||||
|
||||
uint16_t *s = data;
|
||||
uint16_t *s = ASSERT_PTR(data);
|
||||
int r;
|
||||
|
||||
assert(rvalue);
|
||||
assert(data);
|
||||
|
||||
if (isempty(rvalue) || streq(rvalue, "auto")) {
|
||||
*s = 0;
|
||||
@@ -887,15 +884,13 @@ int config_parse_wireguard_route_table(
|
||||
void *data,
|
||||
void *userdata) {
|
||||
|
||||
NetDev *netdev = userdata;
|
||||
uint32_t *table = data;
|
||||
NetDev *netdev = ASSERT_PTR(userdata);
|
||||
uint32_t *table = ASSERT_PTR(data);
|
||||
int r;
|
||||
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(data);
|
||||
assert(userdata);
|
||||
|
||||
if (isempty(rvalue) || parse_boolean(rvalue) == 0) {
|
||||
*table = 0; /* Disabled. */
|
||||
@@ -926,14 +921,13 @@ int config_parse_wireguard_peer_route_table(
|
||||
void *userdata) {
|
||||
|
||||
_cleanup_(wireguard_peer_free_or_set_invalidp) WireguardPeer *peer = NULL;
|
||||
NetDev *netdev = userdata;
|
||||
NetDev *netdev = ASSERT_PTR(userdata);
|
||||
Wireguard *w;
|
||||
int r;
|
||||
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(netdev);
|
||||
assert(netdev->manager);
|
||||
|
||||
w = WIREGUARD(netdev);
|
||||
@@ -981,13 +975,12 @@ int config_parse_wireguard_route_priority(
|
||||
void *data,
|
||||
void *userdata) {
|
||||
|
||||
uint32_t *priority = data;
|
||||
uint32_t *priority = ASSERT_PTR(data);
|
||||
int r;
|
||||
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(data);
|
||||
|
||||
if (isempty(rvalue)) {
|
||||
*priority = 0;
|
||||
|
||||
@@ -179,13 +179,12 @@ int config_parse_wiphy(
|
||||
void *data,
|
||||
void *userdata) {
|
||||
|
||||
WLan *w = userdata;
|
||||
WLan *w = ASSERT_PTR(userdata);
|
||||
int r;
|
||||
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(userdata);
|
||||
|
||||
if (isempty(rvalue)) {
|
||||
w->wiphy_name = mfree(w->wiphy_name);
|
||||
@@ -219,12 +218,11 @@ int config_parse_wlan_iftype(
|
||||
void *data,
|
||||
void *userdata) {
|
||||
|
||||
enum nl80211_iftype t, *iftype = data;
|
||||
enum nl80211_iftype t, *iftype = ASSERT_PTR(data);
|
||||
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(data);
|
||||
|
||||
if (isempty(rvalue)) {
|
||||
*iftype = NL80211_IFTYPE_UNSPECIFIED;
|
||||
|
||||
Reference in New Issue
Block a user