[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJaqyWdfWgC-uthR0aCjitCrBf=ca=Ee1oAB=JumffK=eSLgng@mail.gmail.com>
Date: Fri, 27 May 2022 08:50:16 +0200
From: Eugenio Perez Martin <eperezma@...hat.com>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Stefano Garzarella <sgarzare@...hat.com>,
"Dawar, Gautam" <gautam.dawar@....com>,
"Michael S. Tsirkin" <mst@...hat.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"virtualization@...ts.linux-foundation.org"
<virtualization@...ts.linux-foundation.org>,
Jason Wang <jasowang@...hat.com>,
Zhu Lingshan <lingshan.zhu@...el.com>,
"martinh@...inx.com" <martinh@...inx.com>,
"ecree.xilinx@...il.com" <ecree.xilinx@...il.com>,
Eli Cohen <elic@...dia.com>, Parav Pandit <parav@...dia.com>,
Wu Zongyong <wuzongyong@...ux.alibaba.com>,
"dinang@...inx.com" <dinang@...inx.com>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
Xie Yongji <xieyongji@...edance.com>,
"lulu@...hat.com" <lulu@...hat.com>,
"martinpo@...inx.com" <martinpo@...inx.com>,
"pabloc@...inx.com" <pabloc@...inx.com>,
Longpeng <longpeng2@...wei.com>,
"Piotr.Uminski@...el.com" <Piotr.Uminski@...el.com>,
"Kamde, Tanuj" <tanuj.kamde@....com>,
Si-Wei Liu <si-wei.liu@...cle.com>,
"habetsm.xilinx@...il.com" <habetsm.xilinx@...il.com>,
"lvivier@...hat.com" <lvivier@...hat.com>,
Zhang Min <zhang.min9@....com.cn>,
"hanand@...inx.com" <hanand@...inx.com>
Subject: Re: [PATCH v3 2/4] vhost-vdpa: introduce STOP backend feature bit
On Thu, May 26, 2022 at 9:07 PM Dan Carpenter <dan.carpenter@...cle.com> wrote:
>
> On Thu, May 26, 2022 at 07:00:06PM +0200, Eugenio Perez Martin wrote:
> > > It feels like returning any literal that isn't 1 or 0 should trigger a
> > > warning... I've written that and will check it out tonight.
> > >
> >
> > I'm not sure this should be so strict, or "literal" does not include pointers?
> >
>
> What I mean in exact terms, is that if you're returning a known value
> and the function returns bool then the known value should be 0 or 1.
> Don't "return 3;". This new warning will complain if you return a known
> pointer as in "return &a;". It won't complain if you return an
> unknown pointer "return p;".
>
Ok, thanks for the clarification.
> > As an experiment, can Smatch be used to count how many times a
> > returned pointer is converted to int / bool before returning vs not
> > converted?
>
> I'm not super excited to write that code... :/
>
Sure, I understand. I meant if it was possible or if that is too far
beyond its scope.
> >
> > I find Smatch interesting, especially when switching between projects
> > frequently. Does it support changing the code like clang-format? To
> > offload cognitive load to tools is usually good :).
>
> No. Coccinelle does that really well though.
>
Understood.
Thanks!
> regards,
> dan carpenter
>
Powered by blists - more mailing lists