diff mbox series

[net] dcb_doit: remove redundant skb check

Message ID 20200621165657.9814-1-gaurav1086@gmail.com
State Changes Requested
Delegated to: David Miller
Headers show
Series [net] dcb_doit: remove redundant skb check | expand

Commit Message

Gaurav Singh June 21, 2020, 4:56 p.m. UTC
Remove the redundant null check for skb.

Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
---
 net/dcb/dcbnl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jakub Kicinski June 22, 2020, 7:35 p.m. UTC | #1
On Sun, 21 Jun 2020 12:56:28 -0400 Gaurav Singh wrote:
> Remove the redundant null check for skb.
> 
> Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>

Thanks for the patch, it looks correct, but could you describe your
proof / reasoning based on which this change is correct?

Please post non-bug fixes like this with a [net-next] rather than [net]
tag (https://www.kernel.org/doc/html/latest/networking/netdev-FAQ.html).

> diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
> index d2a4553bcf39..84dde5a2066e 100644
> --- a/net/dcb/dcbnl.c
> +++ b/net/dcb/dcbnl.c
> @@ -1736,7 +1736,7 @@ static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
>  	struct net_device *netdev;
>  	struct dcbmsg *dcb = nlmsg_data(nlh);
>  	struct nlattr *tb[DCB_ATTR_MAX + 1];
> -	u32 portid = skb ? NETLINK_CB(skb).portid : 0;
> +	u32 portid = NETLINK_CB(skb).portid;
>  	int ret = -EINVAL;
>  	struct sk_buff *reply_skb;
>  	struct nlmsghdr *reply_nlh = NULL;
diff mbox series

Patch

diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index d2a4553bcf39..84dde5a2066e 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -1736,7 +1736,7 @@  static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
 	struct net_device *netdev;
 	struct dcbmsg *dcb = nlmsg_data(nlh);
 	struct nlattr *tb[DCB_ATTR_MAX + 1];
-	u32 portid = skb ? NETLINK_CB(skb).portid : 0;
+	u32 portid = NETLINK_CB(skb).portid;
 	int ret = -EINVAL;
 	struct sk_buff *reply_skb;
 	struct nlmsghdr *reply_nlh = NULL;