Commit f597f6b8 authored by Andreas Gruenbacher's avatar Andreas Gruenbacher Committed by Jens Axboe

drbd: Fix future possible NULL pointer dereference

Right now every resource has exactly one connection. But we are preparing
for dynamic connections. I.e. in the future thre can be resources without
connections.

However smatch points this out as 'variable dereferenced before check',
which is correct.

This issue was introduced in
drbd: get_one_status(): Iterate over resource->devices instead of connection->peer_devices
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarAndreas Gruenbacher <agruen@linbit.com>
Signed-off-by: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent 2457b6d5
...@@ -2776,7 +2776,7 @@ static int nla_put_drbd_cfg_context(struct sk_buff *skb, ...@@ -2776,7 +2776,7 @@ static int nla_put_drbd_cfg_context(struct sk_buff *skb,
if (device && if (device &&
nla_put_u32(skb, T_ctx_volume, device->vnr)) nla_put_u32(skb, T_ctx_volume, device->vnr))
goto nla_put_failure; goto nla_put_failure;
if (nla_put_string(skb, T_ctx_resource_name, connection->resource->name)) if (nla_put_string(skb, T_ctx_resource_name, resource->name))
goto nla_put_failure; goto nla_put_failure;
if (connection) { if (connection) {
if (connection->my_addr_len && if (connection->my_addr_len &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment