Skip to content

Commit

Permalink
[IPV4]: Fix rtm_to_ifaddr() error handling.
Browse files Browse the repository at this point in the history
Return negative error value (embedded in the pointer) instead of
returning NULL.

Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Evgeniy Polyakov authored and David S. Miller committed Mar 9, 2007
1 parent 30fbc9f commit c4e38f4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/ipv4/devinet.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,10 @@ static struct in_ifaddr *rtm_to_ifaddr(struct nlmsghdr *nlh)
goto errout;

ifm = nlmsg_data(nlh);
if (ifm->ifa_prefixlen > 32 || tb[IFA_LOCAL] == NULL)
if (ifm->ifa_prefixlen > 32 || tb[IFA_LOCAL] == NULL) {
err = -EINVAL;
goto errout;
}

dev = __dev_get_by_index(ifm->ifa_index);
if (dev == NULL) {
Expand Down

0 comments on commit c4e38f4

Please sign in to comment.