Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: mctp: remove redundant RTN_UNICAST check

Current mctp_newroute() contains two exactly same check against
rtm->rtm_type

static int mctp_newroute(...)
{
...
if (rtm->rtm_type != RTN_UNICAST) { // (1)
NL_SET_ERR_MSG(extack, "rtm_type must be RTN_UNICAST");
return -EINVAL;
}
...
if (rtm->rtm_type != RTN_UNICAST) // (2)
return -EINVAL;
...
}

This commits removes the (2) check as it is redundant.

Signed-off-by: Lin Ma <linma@zju.edu.cn>
Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Acked-by: Jeremy Kerr <jk@codeconstruct.com.au>
Link: https://lore.kernel.org/r/20230615152240.1749428-1-linma@zju.edu.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Lin Ma and committed by
Jakub Kicinski
f60ce8a4 6907217a

-3
-3
net/mctp/route.c
··· 1249 1249 mtu = nla_get_u32(tbx[RTAX_MTU]); 1250 1250 } 1251 1251 1252 - if (rtm->rtm_type != RTN_UNICAST) 1253 - return -EINVAL; 1254 - 1255 1252 rc = mctp_route_add(mdev, daddr_start, rtm->rtm_dst_len, mtu, 1256 1253 rtm->rtm_type); 1257 1254 return rc;