Skip to content

Commit

Permalink
net/hsr: Check skb_put_padto() return value
Browse files Browse the repository at this point in the history
skb_put_padto() will free the sk_buff passed as reference in case of
errors, but we still need to check its return value and decide what to
do.

Detected by CoverityScan, CID#1416688 ("CHECKED_RETURN")

Fixes: ee1c279 ("net/hsr: Added support for HSR v1")
Signed-off-by: Florian Fainelli <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
ffainelli authored and davem330 committed Aug 22, 2017
1 parent c5cff85 commit 414e7d7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/hsr/hsr_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,8 @@ static void send_hsr_supervision_frame(struct hsr_port *master,
hsr_sp = skb_put(skb, sizeof(struct hsr_sup_payload));
ether_addr_copy(hsr_sp->MacAddressA, master->dev->dev_addr);

skb_put_padto(skb, ETH_ZLEN + HSR_HLEN);
if (skb_put_padto(skb, ETH_ZLEN + HSR_HLEN))
return;

hsr_forward_skb(skb, master);
return;
Expand Down

0 comments on commit 414e7d7

Please sign in to comment.