On Thu, Feb 14, 2019 at 11:22:51AM -0500, Joel Fernandes wrote: > On Sat, Feb 09, 2019 at 11:24:03AM +0900, Tetsuo Handa wrote: > > @@ -722,10 +719,17 @@ static int ashmem_pin_unpin(struct ashmem_area *asma, > > unsigned long cmd, > > struct ashmem_pin pin; > > size_t pgstart, pgend; > > int ret = -EINVAL; > > + struct ashmem_range *range = NULL; > > > > if (copy_from_user(&pin, p, sizeof(pin))) > > return -EFAULT; > > > > + if (cmd == ASHMEM_PIN || cmd == ASHMEM_UNPIN) { > > + range = kmem_cache_zalloc(ashmem_range_cachep, GFP_KERNEL); > > + if (!range) > > + return -ENOMEM; > > According to the too-small-to-fail rule, why are you checking for errors > here? >
As a static analysis person, Smatch knows about the GFP_NOFAIL flag. The small size rule would probably be easy enough to implement for 80% of the cases but I have avoided doing that and still patch up the code when I find missing NULL checks. regards, dan carpenter _______________________________________________ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel