Hi Cong,

FYI, there are new smatch warnings show up in

tree:   git://github.com/congwang/linux.git tc-action
head:   32d1a012f22a3ab30382596c2344b11bd60ffe83
commit: d3d8a84365849b8d0e9be0f717229027fcedfe48 [498/499] sched: init struct 
tcf_hashinfo at register time

include/net/act_api.h:55 tcf_hashinfo_init() warn: returning -1 instead of 
-ENOMEM is sloppy

git remote add congwang git://github.com/congwang/linux.git
git remote update congwang
git checkout d3d8a84365849b8d0e9be0f717229027fcedfe48
vim +55 include/net/act_api.h

e9ce1cd3 David S. Miller 2006-08-21  39         struct tcf_common       **htab;
e9ce1cd3 David S. Miller 2006-08-21  40         unsigned int            hmask;
d3d8a843 Cong Wang       2013-12-11  41         rwlock_t                lock;
e9ce1cd3 David S. Miller 2006-08-21  42  };
e9ce1cd3 David S. Miller 2006-08-21  43  
e9ce1cd3 David S. Miller 2006-08-21  44  static inline unsigned int 
tcf_hash(u32 index, unsigned int hmask)
e9ce1cd3 David S. Miller 2006-08-21  45  {
e9ce1cd3 David S. Miller 2006-08-21  46         return index & hmask;
e9ce1cd3 David S. Miller 2006-08-21  47  }
^1da177e Linus Torvalds  2005-04-16  48  
d3d8a843 Cong Wang       2013-12-11  49  static inline int 
tcf_hashinfo_init(struct tcf_hashinfo *hf, unsigned int mask)
d3d8a843 Cong Wang       2013-12-11  50  {
d3d8a843 Cong Wang       2013-12-11  51         rwlock_init(&hf->lock);
d3d8a843 Cong Wang       2013-12-11  52         hf->hmask = mask;
d3d8a843 Cong Wang       2013-12-11  53         if (!(hf->htab = kzalloc((mask 
+ 1) * sizeof(struct tcf_common *),
d3d8a843 Cong Wang       2013-12-11  54                                  
GFP_KERNEL)))

Also checkpatch complains about these assignments in an if statement.

d3d8a843 Cong Wang       2013-12-11 @55                 return -1;
d3d8a843 Cong Wang       2013-12-11  56         return 0;
d3d8a843 Cong Wang       2013-12-11  57  }
d3d8a843 Cong Wang       2013-12-11  58  
d3d8a843 Cong Wang       2013-12-11  59  static inline void 
tcf_hashinfo_destroy(struct tcf_hashinfo *hf)
d3d8a843 Cong Wang       2013-12-11  60  {
d3d8a843 Cong Wang       2013-12-11  61         kfree(hf->htab);
d3d8a843 Cong Wang       2013-12-11  62  }
d3d8a843 Cong Wang       2013-12-11  63  

---
0-DAY kernel build testing backend              Open Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild                 Intel Corporation
_______________________________________________
kbuild mailing list
kbuild@lists.01.org
https://lists.01.org/mailman/listinfo/kbuild

Reply via email to