Re: [PATCH for-next 4/7] RDMA/bnxt_re: Refactor net ring allocation function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 28, 2020 at 6:05 AM Jason Gunthorpe <jgg@xxxxxxxxxxxx> wrote:
>
> On Mon, Jan 27, 2020 at 01:10:10PM +0530, Devesh Sharma wrote:
> > > >  static int bnxt_re_alloc_res(struct bnxt_re_dev *rdev)
> > > >  {
> > > > +     struct bnxt_qplib_ctx *qplib_ctx;
> > > > +     struct bnxt_re_ring_attr rattr;
> > > >       int num_vec_created = 0;
> > > > -     dma_addr_t *pg_map;
> > > >       int rc = 0, i;
> > > > -     int pages;
> > > >       u8 type;
> > > >
> > > > +     memset(&rattr, 0, sizeof(rattr));
> > >
> > > Initialize rattr to zero from the beginning and save call to memset.
> > I moved from static initialization to memset due to some sparse/smatch
> > warnings, rattr has a "pointer member".
>
> That is why you need to use = {} not the weird '= {0}' version
>
> 0 initializes the first member to zero and default initializes the rest
> which doesn't work properly if the first member is not an integral
> value.
>
So should I remove memset(s) in v2?
> Jason



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux