All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [android-common:android14-kiwi-6.1 290/290] drivers/gpu/drm/drm_displayid.c:31 validate_displayid() warn: passing positive error code '(-22)' to 'PTR_ERR'
Date: Sun, 16 Mar 2025 18:57:24 +0800	[thread overview]
Message-ID: <202503161817.AZJv9oo9-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: cros-kernel-buildreports@googlegroups.com

tree:   https://android.googlesource.com/kernel/common android14-kiwi-6.1
head:   d71786d14d19c4686859f15454883795f59bef15
commit: 4b17053ba268bf952c19ecb58d66d5d72e782d13 [290/290] drm/displayid: add displayid_get_header() and check bounds better
:::::: branch date: 28 hours ago
:::::: commit date: 1 year, 10 months ago
config: i386-randconfig-141-20250316 (https://download.01.org/0day-ci/archive/20250316/202503161817.AZJv9oo9-lkp@intel.com/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202503161817.AZJv9oo9-lkp@intel.com/

smatch warnings:
drivers/gpu/drm/drm_displayid.c:31 validate_displayid() warn: passing positive error code '(-22)' to 'PTR_ERR'

vim +31 drivers/gpu/drm/drm_displayid.c

4b17053ba268bf9 Jani Nikula 2023-02-16  22  
4cc4f09eaa06178 Jani Nikula 2021-03-29  23  static int validate_displayid(const u8 *displayid, int length, int idx)
4cc4f09eaa06178 Jani Nikula 2021-03-29  24  {
4cc4f09eaa06178 Jani Nikula 2021-03-29  25  	int i, dispid_length;
4cc4f09eaa06178 Jani Nikula 2021-03-29  26  	u8 csum = 0;
339be1a8e9af736 Jani Nikula 2021-03-29  27  	const struct displayid_header *base;
4cc4f09eaa06178 Jani Nikula 2021-03-29  28  
4b17053ba268bf9 Jani Nikula 2023-02-16  29  	base = displayid_get_header(displayid, length, idx);
4b17053ba268bf9 Jani Nikula 2023-02-16  30  	if (IS_ERR(base))
4b17053ba268bf9 Jani Nikula 2023-02-16 @31  		return PTR_ERR(base);
4cc4f09eaa06178 Jani Nikula 2021-03-29  32  
4cc4f09eaa06178 Jani Nikula 2021-03-29  33  	DRM_DEBUG_KMS("base revision 0x%x, length %d, %d %d\n",
4cc4f09eaa06178 Jani Nikula 2021-03-29  34  		      base->rev, base->bytes, base->prod_id, base->ext_count);
4cc4f09eaa06178 Jani Nikula 2021-03-29  35  
4cc4f09eaa06178 Jani Nikula 2021-03-29  36  	/* +1 for DispID checksum */
4cc4f09eaa06178 Jani Nikula 2021-03-29  37  	dispid_length = sizeof(*base) + base->bytes + 1;
4cc4f09eaa06178 Jani Nikula 2021-03-29  38  	if (dispid_length > length - idx)
4cc4f09eaa06178 Jani Nikula 2021-03-29  39  		return -EINVAL;
4cc4f09eaa06178 Jani Nikula 2021-03-29  40  
4cc4f09eaa06178 Jani Nikula 2021-03-29  41  	for (i = 0; i < dispid_length; i++)
4cc4f09eaa06178 Jani Nikula 2021-03-29  42  		csum += displayid[idx + i];
4cc4f09eaa06178 Jani Nikula 2021-03-29  43  	if (csum) {
4cc4f09eaa06178 Jani Nikula 2021-03-29  44  		DRM_NOTE("DisplayID checksum invalid, remainder is %d\n", csum);
4cc4f09eaa06178 Jani Nikula 2021-03-29  45  		return -EINVAL;
4cc4f09eaa06178 Jani Nikula 2021-03-29  46  	}
4cc4f09eaa06178 Jani Nikula 2021-03-29  47  
4cc4f09eaa06178 Jani Nikula 2021-03-29  48  	return 0;
4cc4f09eaa06178 Jani Nikula 2021-03-29  49  }
4cc4f09eaa06178 Jani Nikula 2021-03-29  50  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2025-03-16 10:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202503161817.AZJv9oo9-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.