Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	syzbot <syzbot+5d32c8bd82427f9c77cc@syzkaller.appspotmail.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	Linux Memory Management List <linux-mm@kvack.org>,
	apopple@nvidia.com, byungchul@sk.com, david@kernel.org,
	gourry@gourry.net, joshua.hahnjy@gmail.com,
	linux-kernel@vger.kernel.org, matthew.brost@intel.com,
	rakie.kim@sk.com, syzkaller-bugs@googlegroups.com,
	ying.huang@linux.alibaba.com, ziy@nvidia.com,
	dri-devel@lists.freedesktop.org,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>
Subject: Re: [PATCH] drm/lease: Limit amount of maximum objects per lease.
Date: Thu, 28 May 2026 17:58:32 +0800	[thread overview]
Message-ID: <202605281701.Blefmpwd-lkp@intel.com> (raw)
In-Reply-To: <b3390013-f0de-4e23-a915-23340594fb49@linux.intel.com>

Hi Maarten,

kernel test robot noticed the following build warnings:

[auto build test WARNING on drm-misc/drm-misc-next]
[also build test WARNING on akpm-mm/mm-everything daeinki-drm-exynos/exynos-drm-next drm/drm-next drm-i915/for-linux-next drm-i915/for-linux-next-fixes drm-tip/drm-tip linus/master v7.1-rc5 next-20260527]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Maarten-Lankhorst/drm-lease-Limit-amount-of-maximum-objects-per-lease/20260527-180216
base:   https://gitlab.freedesktop.org/drm/misc/kernel.git drm-misc-next
patch link:    https://lore.kernel.org/r/b3390013-f0de-4e23-a915-23340594fb49%40linux.intel.com
patch subject: [PATCH] drm/lease: Limit amount of maximum objects per lease.
config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20260528/202605281701.Blefmpwd-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260528/202605281701.Blefmpwd-lkp@intel.com/reproduce)

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>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605281701.Blefmpwd-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/drm_lease.c:513:50: warning: format specifies type 'long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
     513 |                 drm_dbg_lease(dev, "too many objects (%ld)\n", object_count);
         |                                                       ~~~      ^~~~~~~~~~~~
         |                                                       %zu
   include/drm/drm_print.h:663:54: note: expanded from macro 'drm_dbg_lease'
     663 |         drm_dev_dbg(__drm_to_dev(drm), DRM_UT_LEASE, fmt, ##__VA_ARGS__)
         |                                                      ~~~    ^~~~~~~~~~~
   include/drm/drm_print.h:563:39: note: expanded from macro 'drm_dev_dbg'
     563 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
         |                                       ~~~    ^~~~~~~~~~~
   1 warning generated.


vim +513 drivers/gpu/drm/drm_lease.c

   468	
   469	/*
   470	 * The master associated with the specified file will have a lease
   471	 * created containing the objects specified in the ioctl structure.
   472	 * A file descriptor will be allocated for that and returned to the
   473	 * application.
   474	 */
   475	int drm_mode_create_lease_ioctl(struct drm_device *dev,
   476					void *data, struct drm_file *lessor_priv)
   477	{
   478		struct drm_mode_create_lease *cl = data;
   479		size_t object_count;
   480		int ret = 0;
   481		struct idr leases;
   482		struct drm_master *lessor;
   483		struct drm_master *lessee = NULL;
   484		struct file *lessee_file = NULL;
   485		struct file *lessor_file = lessor_priv->filp;
   486		struct drm_file *lessee_priv;
   487		int fd = -1;
   488		uint32_t *object_ids;
   489		static const size_t max_objects =
   490			8 * sizeof(drm_crtc_mask(NULL)) +
   491			8 * sizeof(drm_plane_mask(NULL)) +
   492			8 * sizeof(drm_connector_mask(NULL));
   493	
   494		/* Can't lease without MODESET */
   495		if (!drm_core_check_feature(dev, DRIVER_MODESET))
   496			return -EOPNOTSUPP;
   497	
   498		if (cl->flags && (cl->flags & ~(O_CLOEXEC | O_NONBLOCK))) {
   499			drm_dbg_lease(dev, "invalid flags\n");
   500			return -EINVAL;
   501		}
   502	
   503		lessor = drm_file_get_master(lessor_priv);
   504		/* Do not allow sub-leases */
   505		if (lessor->lessor) {
   506			drm_dbg_lease(dev, "recursive leasing not allowed\n");
   507			ret = -EINVAL;
   508			goto out_lessor;
   509		}
   510	
   511		object_count = cl->object_count;
   512		if (object_count > max_objects) {
 > 513			drm_dbg_lease(dev, "too many objects (%ld)\n", object_count);
   514			ret = -EINVAL;
   515			goto out_lessor;
   516		}
   517	
   518		/* Handle leased objects, if any */
   519		idr_init(&leases);
   520		if (object_count != 0) {
   521			object_ids = memdup_array_user(u64_to_user_ptr(cl->object_ids),
   522						       object_count, sizeof(__u32));
   523			if (IS_ERR(object_ids)) {
   524				ret = PTR_ERR(object_ids);
   525				idr_destroy(&leases);
   526				goto out_lessor;
   527			}
   528	
   529			/* fill and validate the object idr */
   530			ret = fill_object_idr(dev, lessor_priv, &leases,
   531					      object_count, object_ids);
   532			kfree(object_ids);
   533			if (ret) {
   534				drm_dbg_lease(dev, "lease object lookup failed: %i\n", ret);
   535				idr_destroy(&leases);
   536				goto out_lessor;
   537			}
   538		}
   539	
   540		/* Allocate a file descriptor for the lease */
   541		fd = get_unused_fd_flags(cl->flags & (O_CLOEXEC | O_NONBLOCK));
   542		if (fd < 0) {
   543			idr_destroy(&leases);
   544			ret = fd;
   545			goto out_lessor;
   546		}
   547	
   548		drm_dbg_lease(dev, "Creating lease\n");
   549		/* lessee will take the ownership of leases */
   550		lessee = drm_lease_create(lessor, &leases);
   551	
   552		if (IS_ERR(lessee)) {
   553			ret = PTR_ERR(lessee);
   554			idr_destroy(&leases);
   555			goto out_leases;
   556		}
   557	
   558		/* Clone the lessor file to create a new file for us */
   559		drm_dbg_lease(dev, "Allocating lease file\n");
   560		lessee_file = file_clone_open(lessor_file);
   561		if (IS_ERR(lessee_file)) {
   562			ret = PTR_ERR(lessee_file);
   563			goto out_lessee;
   564		}
   565	
   566		lessee_priv = lessee_file->private_data;
   567		/* Change the file to a master one */
   568		drm_master_put(&lessee_priv->master);
   569		lessee_priv->master = lessee;
   570		lessee_priv->is_master = 1;
   571		lessee_priv->authenticated = 1;
   572	
   573		/* Pass fd back to userspace */
   574		drm_dbg_lease(dev, "Returning fd %d id %d\n", fd, lessee->lessee_id);
   575		cl->fd = fd;
   576		cl->lessee_id = lessee->lessee_id;
   577	
   578		/* Hook up the fd */
   579		fd_install(fd, lessee_file);
   580	
   581		drm_master_put(&lessor);
   582		drm_dbg_lease(dev, "drm_mode_create_lease_ioctl succeeded\n");
   583		return 0;
   584	
   585	out_lessee:
   586		drm_master_put(&lessee);
   587	
   588	out_leases:
   589		put_unused_fd(fd);
   590	
   591	out_lessor:
   592		drm_master_put(&lessor);
   593		drm_dbg_lease(dev, "drm_mode_create_lease_ioctl failed: %d\n", ret);
   594		return ret;
   595	}
   596	

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


  reply	other threads:[~2026-05-28  9:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-26  2:49 [syzbot] [mm?] WARNING in alloc_frozen_pages_noprof (2) syzbot
2026-05-26 19:58 ` Andrew Morton
2026-05-27  9:58   ` [PATCH] drm/lease: Limit amount of maximum objects per lease Maarten Lankhorst
2026-05-28  9:58     ` kernel test robot [this message]
2026-05-28 10:22     ` kernel test robot

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=202605281701.Blefmpwd-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=airlied@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=apopple@nvidia.com \
    --cc=byungchul@sk.com \
    --cc=david@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gourry@gourry.net \
    --cc=joshua.hahnjy@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=llvm@lists.linux.dev \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=matthew.brost@intel.com \
    --cc=mripard@kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=rakie.kim@sk.com \
    --cc=simona@ffwll.ch \
    --cc=syzbot+5d32c8bd82427f9c77cc@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=tzimmermann@suse.de \
    --cc=ying.huang@linux.alibaba.com \
    --cc=ziy@nvidia.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox