Hi Corey,

The patch 1da177e4c3f4: "Linux-2.6.12-rc2" from Apr 16, 2005, leads
to the following static checker warning:

        drivers/char/ipmi/ipmi_msghandler.c:1760 i_ipmi_request()
        warn: potential shift truncation.  '0xff << 26'


drivers/char/ipmi/ipmi_msghandler.c
   157  /*
   158   * Store the information in a msgid (long) to allow us to find a
   159   * sequence table entry from the msgid.
   160   */
   161  #define STORE_SEQ_IN_MSGID(seq, seqid) (((seq&0xff)<<26) | 
(seqid&0x3ffffff))

The STORE_SEQ_IN_MSGID() and GET_SEQ_FROM_MSGID() don't match.

It seems clear enough that it should be (((seq & 0x3f) << 26) and that
would silence the static checker warning.  But I think also that in
GET_SEQ_FROM_MSGID() and NEXT_SEQID() we should be using 0x3ffffff
(with 6 f's instead of 5).

   162  
   163  #define GET_SEQ_FROM_MSGID(msgid, seq, seqid) \
   164          do {                                                            
\
   165                  seq = ((msgid >> 26) & 0x3f);                           
\
   166                  seqid = (msgid & 0x3fffff);                             
\
   167          } while (0)
   168  
   169  #define NEXT_SEQID(seqid) (((seqid) + 1) & 0x3fffff)
   170  

regards,
dan carpenter

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Openipmi-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openipmi-developer

Reply via email to