[bug report] afs: Fix access after dec in put functions

Dan Carpenter dan.carpenter at linaro.org
Thu Jul 4 08:25:14 PDT 2024


Hello David Howells,

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

Commit 2757a4dc1849 ("afs: Fix access after dec in put functions")
from Jul 6, 2022, leads to the following Smatch complaint:

    fs/afs/server.c:399 afs_put_server()
    warn: variable dereferenced before check 'server' (see line 395)

fs/afs/server.c
   394	{
   395		unsigned int a, debug_id = server->debug_id;
                                           ^^^^^^^^
The patch added a dereference

   396		bool zero;
   397		int r;
   398	
   399		if (!server)
                ^^^^^^^^^^^^
The existing code checked for NULL

   400			return;
   401	

regards,
dan carpenter



More information about the linux-afs mailing list