From: kernel test robot <lkp@intel.com>
To: cros-kernel-buildreports@googlegroups.com
Cc: oe-kbuild-all@lists.linux.dev
Subject: [android-common:android12-5.10-2022-10 21714/21865] drivers/dma-buf/dma-buf-sysfs-stats.c:142:2: error: static assertion failed due to requirement 'sizeof(struct kobject) >= sizeof(struct work_struct)': kobject is smaller than work_struct
Date: Sat, 8 Jul 2023 07:20:14 +0800 [thread overview]
Message-ID: <202307080710.bfva0ZXb-lkp@intel.com> (raw)
Hi Mercier,
FYI, the error/warning still remains.
tree: https://android.googlesource.com/kernel/common android12-5.10-2022-10
head: 987d4745ed78ca0f958513bab62fa9de303f2676
commit: d34064cf6258cb4980ac890e00c3f5e75066d905 [21714/21865] BACKPORT: ANDROID: dma-buf: Move sysfs work out of DMA-BUF export path
config: x86_64-buildonly-randconfig-r002-20230708 (https://download.01.org/0day-ci/archive/20230708/202307080710.bfva0ZXb-lkp@intel.com/config)
compiler: clang version 15.0.7 (https://github.com/llvm/llvm-project.git 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a)
reproduce: (https://download.01.org/0day-ci/archive/20230708/202307080710.bfva0ZXb-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/202307080710.bfva0ZXb-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/dma-buf/dma-buf-sysfs-stats.c:142:2: error: static assertion failed due to requirement 'sizeof(struct kobject) >= sizeof(struct work_struct)': kobject is smaller than work_struct
_Static_assert(sizeof(struct kobject) >= sizeof(struct work_struct),
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
vim +142 drivers/dma-buf/dma-buf-sysfs-stats.c
138
139 static void sysfs_add_workfn(struct work_struct *work)
140 {
141 /* The ABI would have to change for this to be false, but let's be paranoid. */
> 142 _Static_assert(sizeof(struct kobject) >= sizeof(struct work_struct),
143 "kobject is smaller than work_struct");
144
145 struct dma_buf_sysfs_entry *sysfs_entry =
146 container_of((struct kobject *)work, struct dma_buf_sysfs_entry, kobj);
147 struct dma_buf *dmabuf = sysfs_entry->dmabuf;
148
149 /*
150 * A dmabuf is ref-counted via its file member. If this handler holds the only
151 * reference to the dmabuf, there is no need for sysfs kobject creation. This is an
152 * optimization and a race; when the reference count drops to 1 immediately after
153 * this check it is not harmful as the sysfs entry will still get cleaned up in
154 * dma_buf_stats_teardown, which won't get called until the final dmabuf reference
155 * is released, and that can't happen until the end of this function.
156 */
157 if (file_count(dmabuf->file) > 1) {
158 /*
159 * kobject_init_and_add expects kobject to be zero-filled, but we have populated it
160 * to trigger this work function.
161 */
162 memset(&dmabuf->sysfs_entry->kobj, 0, sizeof(dmabuf->sysfs_entry->kobj));
163 dmabuf->sysfs_entry->kobj.kset = dma_buf_per_buffer_stats_kset;
164 if (kobject_init_and_add(&dmabuf->sysfs_entry->kobj, &dma_buf_ktype, NULL,
165 "%lu", file_inode(dmabuf->file)->i_ino)) {
166 kobject_put(&dmabuf->sysfs_entry->kobj);
167 dmabuf->sysfs_entry = NULL;
168 }
169 } else {
170 /*
171 * Free the sysfs_entry and reset the pointer so dma_buf_stats_teardown doesn't
172 * attempt to operate on it.
173 */
174 kfree(dmabuf->sysfs_entry);
175 dmabuf->sysfs_entry = NULL;
176 }
177 dma_buf_put(dmabuf);
178 }
179
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2023-07-07 23:21 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=202307080710.bfva0ZXb-lkp@intel.com \
--to=lkp@intel.com \
--cc=cros-kernel-buildreports@googlegroups.com \
--cc=oe-kbuild-all@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.