Hello David Howells,

This is a semi-automatic email about new static checker warnings.

The patch a5b3a80b899b: "CacheFiles: Provide read-and-reset release 
counters for cachefilesd" from Feb 1, 2016, leads to the following 
Smatch complaint:

fs/cachefiles/interface.c:295 cachefiles_drop_object()
         error: we previously assumed 'object->dentry' could be null (see line 
276)

fs/cachefiles/interface.c
   275           */
   276          if (object->dentry) {
                    ^^^^^^^^^^^^^^
Check for NULL.

   277                  /* delete retired objects */
   278                  if (test_bit(FSCACHE_OBJECT_RETIRED, 
&object->fscache.flags) &&
   279                      _object != cache->cache.fsdef
   280                      ) {
   281                          _debug("- retire object OBJ%x", 
object->fscache.debug_id);
   282                          cachefiles_begin_secure(cache, &saved_cred);
   283                          cachefiles_delete_object(cache, object);
   284                          cachefiles_end_secure(cache, saved_cred);
   285                  }
   286  
   287                  /* close the filesystem stuff attached to the object */
   288                  if (object->backer != object->dentry)
   289                          dput(object->backer);
   290                  object->backer = NULL;
   291          }
   292  
   293          /* note that the object is now inactive */
   294          if (test_bit(CACHEFILES_OBJECT_ACTIVE, &object->flags))
   295                  cachefiles_mark_object_inactive(cache, object);
                                                               ^^^^^^
Unchecked dereference inside the function.  Perhaps CACHEFILES_OBJECT_ACTIVE
implies it's non-NULL but it would probably easier to read if we moved
it inside the above if statement.

   296  
   297          dput(object->dentry);

regards,
dan carpenter

--
Linux-cachefs mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-cachefs

Reply via email to