Hello Tino Reichardt,

The patch 0d59722ea777: "fs/jfs: TRIM support for JFS Filesystem"
from Aug 29, 2012, leads to the following static checker warning:
fs/jfs/jfs_dmap.c:1650 dbDiscardAG()
         warn: check 'range_cnt' for negative values

  1648          nblocks = bmp->db_agfree[agno];
  1649          range_cnt = min_t(int, range_cnt, nblocks / minlen + 1);
                                  ^^^
Could we make this unsigned?  The caller checks that minlen is >= 1 and
probably someone checks nblocks as well, but it's annoying to have to
audit this.

  1650          totrim = kmalloc(sizeof(struct range2trim) * range_cnt, 
GFP_NOFS);
  1651          if (totrim == NULL) {
  1652                  jfs_error(bmp->db_ipbmap->i_sb,
  1653                            "dbDiscardAG: no memory for trim array");
  1654                  IWRITE_UNLOCK(ipbmap);
  1655                  return 0;
  1656          }

regards,
dan carpenter


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Jfs-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jfs-discussion

Reply via email to