All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] net: vlan: Avoid using BUG() in vlan_proto_idx()
@ 2020-09-29  9:28 Dan Carpenter
  2020-09-29 16:45 ` Florian Fainelli
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-09-29  9:28 UTC (permalink / raw)
  To: kernel-janitors

Hello Florian Fainelli,

The patch d0186842ec5f: "net: vlan: Avoid using BUG() in
vlan_proto_idx()" from Sep 24, 2020, leads to the following static
checker warning:

	net/8021q/vlan.c:60 vlan_group_prealloc_vid()
	warn: unsigned 'pidx' is never less than zero.

net/8021q/vlan.c
    50  static int vlan_group_prealloc_vid(struct vlan_group *vg,
    51                                     __be16 vlan_proto, u16 vlan_id)
    52  {
    53          struct net_device **array;
    54          unsigned int pidx, vidx;
                ^^^^^^^^^^^^^^^^^^^^^^^^

    55          unsigned int size;
    56  
    57          ASSERT_RTNL();
    58  
    59          pidx  = vlan_proto_idx(vlan_proto);
    60          if (pidx < 0)
                    ^^^^^^^^
This is unsigned.

    61                  return -EINVAL;
    62  
    63          vidx  = vlan_id / VLAN_GROUP_ARRAY_PART_LEN;
    64          array = vg->vlan_devices_arrays[pidx][vidx];
    65          if (array != NULL)
    66                  return 0;

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [bug report] net: vlan: Avoid using BUG() in vlan_proto_idx()
  2020-09-29  9:28 [bug report] net: vlan: Avoid using BUG() in vlan_proto_idx() Dan Carpenter
@ 2020-09-29 16:45 ` Florian Fainelli
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Fainelli @ 2020-09-29 16:45 UTC (permalink / raw)
  To: kernel-janitors



On 9/29/2020 2:28 AM, Dan Carpenter wrote:
> Hello Florian Fainelli,
> 
> The patch d0186842ec5f: "net: vlan: Avoid using BUG() in
> vlan_proto_idx()" from Sep 24, 2020, leads to the following static
> checker warning:
> 
> 	net/8021q/vlan.c:60 vlan_group_prealloc_vid()
> 	warn: unsigned 'pidx' is never less than zero.

Fixed with:

https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id\x0675c285ea65540cccae64c87dfc7a00c7ede03a

Thanks
-- 
Florian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-29 16:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-29  9:28 [bug report] net: vlan: Avoid using BUG() in vlan_proto_idx() Dan Carpenter
2020-09-29 16:45 ` Florian Fainelli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.