lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202210191908.y4HrAurF-lkp@intel.com>
Date:   Wed, 19 Oct 2022 23:16:06 +0800
From:   kernel test robot <lkp@...el.com>
To:     Hans Verkuil <hverkuil@...all.nl>
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        linux-media@...r.kernel.org
Subject: drivers/staging/media/deprecated/cpia2/cpia2_usb.c:80:13: warning:
 variable 'frame_count' set but not used

Hi Hans,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   aae703b02f92bde9264366c545e87cec451de471
commit: be8cebc46d9d38166a1b3fda22a018ae52b0928e media: cpia2: deprecate this driver
date:   7 weeks ago
config: arm64-allmodconfig
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 791a7ae1ba3efd6bca96338e10ffde557ba83920)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=be8cebc46d9d38166a1b3fda22a018ae52b0928e
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout be8cebc46d9d38166a1b3fda22a018ae52b0928e
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/gpu/drm/amd/amdgpu/ drivers/staging/media/deprecated/cpia2/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

>> drivers/staging/media/deprecated/cpia2/cpia2_usb.c:80:13: warning: variable 'frame_count' set but not used [-Wunused-but-set-variable]
           static int frame_count;
                      ^
   1 warning generated.


vim +/frame_count +80 drivers/staging/media/deprecated/cpia2/cpia2_usb.c

ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27   71  
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27   72  
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27   73  /******************************************************************************
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27   74   *
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27   75   *  process_frame
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27   76   *
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27   77   *****************************************************************************/
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27   78  static void process_frame(struct camera_data *cam)
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27   79  {
ff699e6bd02eb1 drivers/media/video/cpia2/cpia2_usb.c Douglas Schilling Landgraf 2008-04-22  @80  	static int frame_count;
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27   81  
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27   82  	unsigned char *inbuff = cam->workbuff->data;
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27   83  
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27   84  	DBG("Processing frame #%d, current:%d\n",
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27   85  	    cam->workbuff->num, cam->curbuff->num);
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27   86  
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27   87  	if(cam->workbuff->length > cam->workbuff->max_length)
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27   88  		cam->workbuff->max_length = cam->workbuff->length;
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27   89  
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27   90  	if ((inbuff[0] == 0xFF) && (inbuff[1] == 0xD8)) {
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27   91  		frame_count++;
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27   92  	} else {
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27   93  		cam->workbuff->status = FRAME_ERROR;
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27   94  		DBG("Start of frame not found\n");
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27   95  		return;
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27   96  	}
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27   97  
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27   98  	/***
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27   99  	 * Now the output buffer should have a JPEG image in it.
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  100  	 ***/
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  101  	if(!cam->first_image_seen) {
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  102  		/* Always skip the first image after streaming
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  103  		 * starts. It is almost certainly corrupt. */
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  104  		cam->first_image_seen = 1;
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  105  		cam->workbuff->status = FRAME_EMPTY;
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  106  		return;
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  107  	}
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  108  	if (cam->workbuff->length > 3) {
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  109  		if(cam->mmapped &&
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  110  		   cam->workbuff->length < cam->workbuff->max_length) {
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  111  			/* No junk in the buffers */
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  112  			memset(cam->workbuff->data+cam->workbuff->length,
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  113  			       0, cam->workbuff->max_length-
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  114  				  cam->workbuff->length);
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  115  		}
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  116  		cam->workbuff->max_length = cam->workbuff->length;
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  117  		cam->workbuff->status = FRAME_READY;
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  118  
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  119  		if(!cam->mmapped && cam->num_frames > 2) {
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  120  			/* During normal reading, the most recent
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  121  			 * frame will be read.  If the current frame
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  122  			 * hasn't started reading yet, it will never
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  123  			 * be read, so mark it empty.  If the buffer is
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  124  			 * mmapped, or we have few buffers, we need to
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  125  			 * wait for the user to free the buffer.
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  126  			 *
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  127  			 * NOTE: This is not entirely foolproof with 3
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  128  			 * buffers, but it would take an EXTREMELY
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  129  			 * overloaded system to cause problems (possible
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  130  			 * image data corruption).  Basically, it would
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  131  			 * need to take more time to execute cpia2_read
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  132  			 * than it would for the camera to send
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  133  			 * cam->num_frames-2 frames before problems
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  134  			 * could occur.
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  135  			 */
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  136  			cam->curbuff->status = FRAME_EMPTY;
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  137  		}
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  138  		cam->curbuff = cam->workbuff;
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  139  		cam->workbuff = cam->workbuff->next;
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  140  		DBG("Changed buffers, work:%d, current:%d\n",
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  141  		    cam->workbuff->num, cam->curbuff->num);
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  142  		return;
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  143  	} else {
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  144  		DBG("Not enough data for an image.\n");
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  145  	}
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  146  
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  147  	cam->workbuff->status = FRAME_ERROR;
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  148  	return;
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  149  }
ab33d5071de7a3 drivers/media/video/cpia2/cpia2_usb.c Alan Cox                   2006-02-27  150  

:::::: The code at line 80 was first introduced by commit
:::::: ff699e6bd02eb1c6d02c7c2b576c2ee6caab201c V4L/DVB (7094):  static memory

:::::: TO: Douglas Schilling Landgraf <dougsland@...il.com>
:::::: CC: Mauro Carvalho Chehab <mchehab@...radead.org>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

View attachment "config" of type "text/plain" (350165 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ