Powered by Linux
Re: Odd smatch issue? — Semantic Matching Tool

Re: Odd smatch issue?

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

 



On Mon, Jan 14, 2019 at 01:18:04PM +0300, Dan Carpenter wrote:

> > static long
> > lx_cap_update_priv(void)
> > {
> >         const int lx_cap_mapping[4] = { 0, 0, 0 };
> >         int i = 63;
> >         /* enabling the below line disables the warning */
> >         //int cap_set = i == 0;
> >         lx_cap_mapping[i];
> > }
> > 
> 
> Thanks John,
> 
> I am testing this patch:
> 
> [PATCH] extra: preserve hard_max after comparisons to zero

Thanks for taking a look. Unfortunately this still doesn't seem to cover
the original case which the above was boiled down from. This does:

 76 #define LX_CAP_CAPISSET(id, cap) \                                               
 77         (((id < 32) && (((0x1 << id) & cap[0]) != 0)) || \                       
 78         ((id >= 32) && (((0x1 << (id - 32) & cap[1]) != 0))))                    


221         for (i = 0; i <= LX_CAP_MAX_CHECK; i++) {                                
222                 cap_set = LX_CAP_CAPISSET(i, cap);                               
223                 if (lx_cap_mapping[i] == NULL || i > LX_CAP_MAX_VALID) {         

(The code is bug is on line :223 where we need to reverse the order of the checks.)

regards
john



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux