RE: [PATCH] spi: Fix invalid sgs value

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

 



Hi Mark,

> Subject: Re: [PATCH] spi: Fix invalid sgs value
> 
> On Mon, Mar 07, 2022 at 06:17:23PM +0000, Biju Das wrote:
> 
> > > >         if (vmalloced_buf || kmap_buf) {
> > > > -               desc_len = min_t(int, max_seg_size, PAGE_SIZE);
> > > > +               desc_len = min_t(unsigned int, max_seg_size,
> > > > + PAGE_SIZE);
> > > >                 sgs = DIV_ROUND_UP(len + offset_in_page(buf),
> desc_len);
> > > >         } else if (virt_addr_valid(buf)) {
> > > > -               desc_len = min_t(int, max_seg_size, ctlr-
> >max_dma_len);
> > > > +               desc_len = min_t(unsigned int, max_seg_size,
> > > > + (unsigned int)ctlr->max_dma_len);
> 
> > > The cast of the last parameter is not needed.
> 
> > OK. I thought since last param is size_t, casting is required.
> > OK will drop this.
> 
> In general unless you're getting a warning and are *very* clear on why
> what's being done is valid casts should be avoided.

Agreed.

Cheers,
Biju




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux