kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* re: tun: add VNET_LE flag
@ 2014-12-16  9:28 Dan Carpenter
  2014-12-16  9:34 ` Michael S. Tsirkin
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2014-12-16  9:28 UTC (permalink / raw)
  To: kernel-janitors

Hello Michael S. Tsirkin,

The patch e999d6ea2a4f: "tun: add VNET_LE flag" from Nov 18, 2014,
leads to the following static checker warning:

	drivers/net/tun.c:1694 tun_set_iff()
	warn: 0x17100 is larger than 16 bits

drivers/net/tun.c
  1692  
  1693          tun->flags = (tun->flags & ~TUN_FEATURES) |
  1694                  (ifr->ifr_flags & TUN_FEATURES);
  1695  

It's complaining because the "ifr->ifr_flags" variable is a short
(should it be unsigned?).  The new define:

#define IFF_VNET_LE    0x10000

doesn't fit in two bytes.  Other suspect looking code could be:

	return __virtio16_to_cpu(q->flags & IFF_VNET_LE, val);

regards,
dan carpenter

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

* Re: tun: add VNET_LE flag
  2014-12-16  9:28 tun: add VNET_LE flag Dan Carpenter
@ 2014-12-16  9:34 ` Michael S. Tsirkin
  0 siblings, 0 replies; 2+ messages in thread
From: Michael S. Tsirkin @ 2014-12-16  9:34 UTC (permalink / raw)
  To: kernel-janitors

On Tue, Dec 16, 2014 at 12:28:05PM +0300, Dan Carpenter wrote:
> Hello Michael S. Tsirkin,
> 
> The patch e999d6ea2a4f: "tun: add VNET_LE flag" from Nov 18, 2014,
> leads to the following static checker warning:
> 
> 	drivers/net/tun.c:1694 tun_set_iff()
> 	warn: 0x17100 is larger than 16 bits
> 
> drivers/net/tun.c
>   1692  
>   1693          tun->flags = (tun->flags & ~TUN_FEATURES) |
>   1694                  (ifr->ifr_flags & TUN_FEATURES);
>   1695  
> 
> It's complaining because the "ifr->ifr_flags" variable is a short
> (should it be unsigned?).  The new define:
> 
> #define IFF_VNET_LE    0x10000
> 
> doesn't fit in two bytes.  Other suspect looking code could be:
> 
> 	return __virtio16_to_cpu(q->flags & IFF_VNET_LE, val);
> 
> regards,
> dan carpenter


Thanks!
Of course most testing is on an LE host so it's hard to notice.
I'll fix it up.


-- 
MST

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

end of thread, other threads:[~2014-12-16  9:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-16  9:28 tun: add VNET_LE flag Dan Carpenter
2014-12-16  9:34 ` Michael S. Tsirkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).