From: kernel test robot <lkp@intel.com>
To: Simon Ser <contact@emersion.fr>, dri-devel@lists.freedesktop.org
Cc: kbuild-all@lists.01.org, "Daniel Vetter" <daniel.vetter@ffwll.ch>,
"Andrzej Pietrasiewicz" <andrzej.p@collabora.com>,
clang-built-linux@googlegroups.com,
"Noralf Trønnes" <noralf@tronnes.org>,
"Sam Ravnborg" <sam@ravnborg.org>
Subject: Re: [PATCH] drm: log errors in drm_gem_fb_init_with_funcs
Date: Sat, 1 May 2021 01:59:25 +0800 [thread overview]
Message-ID: <202105010152.FVrCYxUb-lkp@intel.com> (raw)
In-Reply-To: <R359hIfrDhyN2VBgiSyQ1ogbifYmn7KwIuMUqS3u3A@cp4-web-032.plabs.ch>
[-- Attachment #1: Type: text/plain, Size: 5344 bytes --]
Hi Simon,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on drm-tip/drm-tip drm-exynos/exynos-drm-next tegra-drm/drm/tegra/for-next linus/master v5.12 next-20210430]
[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]
url: https://github.com/0day-ci/linux/commits/Simon-Ser/drm-log-errors-in-drm_gem_fb_init_with_funcs/20210430-224208
base: git://anongit.freedesktop.org/drm-intel for-linux-next
config: riscv-randconfig-r012-20210430 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8f5a2a5836cc8e4c1def2bdeb022e7b496623439)
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 riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/9a5b8d668b957989ae026f9f91da5ed59d831ef5
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Simon-Ser/drm-log-errors-in-drm_gem_fb_init_with_funcs/20210430-224208
git checkout 9a5b8d668b957989ae026f9f91da5ed59d831ef5
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=riscv
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/gpu/drm/drm_gem_framebuffer_helper.c:176:9: warning: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
objs[i]->size, min_size, i);
^~~~~~~~~~~~~
include/drm/drm_print.h:450:45: note: expanded from macro 'drm_dbg_kms'
drm_dev_dbg((drm)->dev, DRM_UT_KMS, fmt, ##__VA_ARGS__)
~~~ ^~~~~~~~~~~
1 warning generated.
vim +176 drivers/gpu/drm/drm_gem_framebuffer_helper.c
118
119 /**
120 * drm_gem_fb_init_with_funcs() - Helper function for implementing
121 * &drm_mode_config_funcs.fb_create
122 * callback in cases when the driver
123 * allocates a subclass of
124 * struct drm_framebuffer
125 * @dev: DRM device
126 * @fb: framebuffer object
127 * @file: DRM file that holds the GEM handle(s) backing the framebuffer
128 * @mode_cmd: Metadata from the userspace framebuffer creation request
129 * @funcs: vtable to be used for the new framebuffer object
130 *
131 * This function can be used to set &drm_framebuffer_funcs for drivers that need
132 * custom framebuffer callbacks. Use drm_gem_fb_create() if you don't need to
133 * change &drm_framebuffer_funcs. The function does buffer size validation.
134 * The buffer size validation is for a general case, though, so users should
135 * pay attention to the checks being appropriate for them or, at least,
136 * non-conflicting.
137 *
138 * Returns:
139 * Zero or a negative error code.
140 */
141 int drm_gem_fb_init_with_funcs(struct drm_device *dev,
142 struct drm_framebuffer *fb,
143 struct drm_file *file,
144 const struct drm_mode_fb_cmd2 *mode_cmd,
145 const struct drm_framebuffer_funcs *funcs)
146 {
147 const struct drm_format_info *info;
148 struct drm_gem_object *objs[4];
149 int ret, i;
150
151 info = drm_get_format_info(dev, mode_cmd);
152 if (!info) {
153 drm_dbg_kms(dev, "Failed to get FB format info\n");
154 return -EINVAL;
155 }
156
157 for (i = 0; i < info->num_planes; i++) {
158 unsigned int width = mode_cmd->width / (i ? info->hsub : 1);
159 unsigned int height = mode_cmd->height / (i ? info->vsub : 1);
160 unsigned int min_size;
161
162 objs[i] = drm_gem_object_lookup(file, mode_cmd->handles[i]);
163 if (!objs[i]) {
164 drm_dbg_kms(dev, "Failed to lookup GEM object\n");
165 ret = -ENOENT;
166 goto err_gem_object_put;
167 }
168
169 min_size = (height - 1) * mode_cmd->pitches[i]
170 + drm_format_info_min_pitch(info, i, width)
171 + mode_cmd->offsets[i];
172
173 if (objs[i]->size < min_size) {
174 drm_dbg_kms(dev,
175 "GEM object size (%u) smaller than minimum size (%u) for plane %d\n",
> 176 objs[i]->size, min_size, i);
177 drm_gem_object_put(objs[i]);
178 ret = -EINVAL;
179 goto err_gem_object_put;
180 }
181 }
182
183 ret = drm_gem_fb_init(dev, fb, mode_cmd, objs, i, funcs);
184 if (ret)
185 goto err_gem_object_put;
186
187 return 0;
188
189 err_gem_object_put:
190 for (i--; i >= 0; i--)
191 drm_gem_object_put(objs[i]);
192
193 return ret;
194 }
195 EXPORT_SYMBOL_GPL(drm_gem_fb_init_with_funcs);
196
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 25904 bytes --]
[-- Attachment #3: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH] drm: log errors in drm_gem_fb_init_with_funcs
Date: Sat, 01 May 2021 01:59:25 +0800 [thread overview]
Message-ID: <202105010152.FVrCYxUb-lkp@intel.com> (raw)
In-Reply-To: <R359hIfrDhyN2VBgiSyQ1ogbifYmn7KwIuMUqS3u3A@cp4-web-032.plabs.ch>
[-- Attachment #1: Type: text/plain, Size: 5471 bytes --]
Hi Simon,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on drm-tip/drm-tip drm-exynos/exynos-drm-next tegra-drm/drm/tegra/for-next linus/master v5.12 next-20210430]
[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]
url: https://github.com/0day-ci/linux/commits/Simon-Ser/drm-log-errors-in-drm_gem_fb_init_with_funcs/20210430-224208
base: git://anongit.freedesktop.org/drm-intel for-linux-next
config: riscv-randconfig-r012-20210430 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8f5a2a5836cc8e4c1def2bdeb022e7b496623439)
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 riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/9a5b8d668b957989ae026f9f91da5ed59d831ef5
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Simon-Ser/drm-log-errors-in-drm_gem_fb_init_with_funcs/20210430-224208
git checkout 9a5b8d668b957989ae026f9f91da5ed59d831ef5
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=riscv
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/gpu/drm/drm_gem_framebuffer_helper.c:176:9: warning: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
objs[i]->size, min_size, i);
^~~~~~~~~~~~~
include/drm/drm_print.h:450:45: note: expanded from macro 'drm_dbg_kms'
drm_dev_dbg((drm)->dev, DRM_UT_KMS, fmt, ##__VA_ARGS__)
~~~ ^~~~~~~~~~~
1 warning generated.
vim +176 drivers/gpu/drm/drm_gem_framebuffer_helper.c
118
119 /**
120 * drm_gem_fb_init_with_funcs() - Helper function for implementing
121 * &drm_mode_config_funcs.fb_create
122 * callback in cases when the driver
123 * allocates a subclass of
124 * struct drm_framebuffer
125 * @dev: DRM device
126 * @fb: framebuffer object
127 * @file: DRM file that holds the GEM handle(s) backing the framebuffer
128 * @mode_cmd: Metadata from the userspace framebuffer creation request
129 * @funcs: vtable to be used for the new framebuffer object
130 *
131 * This function can be used to set &drm_framebuffer_funcs for drivers that need
132 * custom framebuffer callbacks. Use drm_gem_fb_create() if you don't need to
133 * change &drm_framebuffer_funcs. The function does buffer size validation.
134 * The buffer size validation is for a general case, though, so users should
135 * pay attention to the checks being appropriate for them or, at least,
136 * non-conflicting.
137 *
138 * Returns:
139 * Zero or a negative error code.
140 */
141 int drm_gem_fb_init_with_funcs(struct drm_device *dev,
142 struct drm_framebuffer *fb,
143 struct drm_file *file,
144 const struct drm_mode_fb_cmd2 *mode_cmd,
145 const struct drm_framebuffer_funcs *funcs)
146 {
147 const struct drm_format_info *info;
148 struct drm_gem_object *objs[4];
149 int ret, i;
150
151 info = drm_get_format_info(dev, mode_cmd);
152 if (!info) {
153 drm_dbg_kms(dev, "Failed to get FB format info\n");
154 return -EINVAL;
155 }
156
157 for (i = 0; i < info->num_planes; i++) {
158 unsigned int width = mode_cmd->width / (i ? info->hsub : 1);
159 unsigned int height = mode_cmd->height / (i ? info->vsub : 1);
160 unsigned int min_size;
161
162 objs[i] = drm_gem_object_lookup(file, mode_cmd->handles[i]);
163 if (!objs[i]) {
164 drm_dbg_kms(dev, "Failed to lookup GEM object\n");
165 ret = -ENOENT;
166 goto err_gem_object_put;
167 }
168
169 min_size = (height - 1) * mode_cmd->pitches[i]
170 + drm_format_info_min_pitch(info, i, width)
171 + mode_cmd->offsets[i];
172
173 if (objs[i]->size < min_size) {
174 drm_dbg_kms(dev,
175 "GEM object size (%u) smaller than minimum size (%u) for plane %d\n",
> 176 objs[i]->size, min_size, i);
177 drm_gem_object_put(objs[i]);
178 ret = -EINVAL;
179 goto err_gem_object_put;
180 }
181 }
182
183 ret = drm_gem_fb_init(dev, fb, mode_cmd, objs, i, funcs);
184 if (ret)
185 goto err_gem_object_put;
186
187 return 0;
188
189 err_gem_object_put:
190 for (i--; i >= 0; i--)
191 drm_gem_object_put(objs[i]);
192
193 return ret;
194 }
195 EXPORT_SYMBOL_GPL(drm_gem_fb_init_with_funcs);
196
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 25904 bytes --]
next prev parent reply other threads:[~2021-04-30 18:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-30 14:40 [PATCH] drm: log errors in drm_gem_fb_init_with_funcs Simon Ser
2021-04-30 14:46 ` Michel Dänzer
2021-04-30 15:28 ` Ville Syrjälä
2021-04-30 17:59 ` kernel test robot [this message]
2021-04-30 17:59 ` 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=202105010152.FVrCYxUb-lkp@intel.com \
--to=lkp@intel.com \
--cc=andrzej.p@collabora.com \
--cc=clang-built-linux@googlegroups.com \
--cc=contact@emersion.fr \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=kbuild-all@lists.01.org \
--cc=noralf@tronnes.org \
--cc=sam@ravnborg.org \
/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.