From: kernel test robot <lkp@intel.com>
To: cros-kernel-buildreports@googlegroups.com
Cc: oe-kbuild-all@lists.linux.dev
Subject: [android-common:android16-6.12 20/20] drivers/android/wrapfd.c:2077:33: warning: cast to pointer from integer of different size
Date: Sat, 07 Nov 2026 10:15:36 +0100 [thread overview]
Message-ID: <202611071053.Pkp9bjCP-lkp@intel.com> (raw)
tree: https://android.googlesource.com/kernel/common android16-6.12
head: 3962e99d7c7335f02f63527384d5ae487da648d1
commit: db3f3b27b0f1e3768035cf280295fba6a5653568 [20/20] ANDROID: wrapfd: polling support
config: i386-randconfig-r2308-20261107 (https://download.01.org/0day-ci/archive/20261107/202611071053.Pkp9bjCP-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
sparse: v0.6.5-rc1-21-g84ec0658
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261107/202611071053.Pkp9bjCP-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/202611071053.Pkp9bjCP-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/android/wrapfd.c: In function 'process_monitors':
>> drivers/android/wrapfd.c:2077:33: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
2077 | if (copy_from_user(arr, (void __user *)monitors->arr,
| ^
drivers/android/wrapfd.c:2161:26: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
2161 | if (copy_to_user((void __user *)monitors->results, results,
| ^
drivers/android/wrapfd.c: In function 'wrapfd_dev_query_events':
drivers/android/wrapfd.c:2241:26: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
2241 | if (copy_to_user((void __user *)events.arr, arr,
| ^
vim +2077 drivers/android/wrapfd.c
2055
2056 static long process_monitors(struct file_monitor *file_mon,
2057 struct wrapfd_monitors *monitors, bool add)
2058 {
2059 struct wrap_event_info *tmp = NULL;
2060 struct wrapfd_monitor *arr;
2061 __u64 *results;
2062 long ret = 0;
2063
2064 if (!monitors->len || monitors->len > WRAPFD_MAX_NR_MONITORS)
2065 return -EINVAL;
2066
2067 arr = kzalloc_objs(struct wrapfd_monitor, monitors->len);
2068 if (!arr)
2069 return -ENOMEM;
2070
2071 results = kzalloc_objs(__u64, monitors->len);
2072 if (!results) {
2073 ret = -ENOMEM;
2074 goto free_arr;
2075 }
2076
> 2077 if (copy_from_user(arr, (void __user *)monitors->arr,
2078 monitors->len * sizeof(struct wrapfd_monitor))) {
2079 ret = -EFAULT;
2080 goto free_res;
2081 }
2082
2083 /* Verify all inputs */
2084 for (__u64 i = 0; i < monitors->len; i++) {
2085 struct wrapfd_monitor *monitor = &arr[i];
2086 struct wrap_event_info *event_info;
2087 struct wrap_ctx *ctx;
2088 struct file *file;
2089 struct fd f;
2090
2091 if (monitor->events & ~WRAPFD_EVENTS_MASK ||
2092 (monitor->events & WRAPFD_EVENTS_MASK) == 0) {
2093 results[i] = -EINVAL;
2094 continue;
2095 }
2096
2097 if (monitor->fd > INT_MAX) {
2098 results[i] = -EBADF;
2099 continue;
2100 }
2101
2102 f = fdget(monitor->fd);
2103 file = fd_file(f);
2104 if (!file || file->f_op != &wrap_fops) {
2105 fdput(f);
2106 results[i] = -EBADF;
2107 continue;
2108 }
2109
2110 ctx = file->private_data;
2111 if (add && !tmp) {
2112 /*
2113 * Preallocate wrap_event_info before locking in case
2114 * we need it later.
2115 */
2116 tmp = kzalloc_obj(*tmp);
2117 }
2118
2119 spin_lock(&ctx->lock);
2120 spin_lock(&file_mon->event_lock);
2121 event_info = find_wrap_event_info(file_mon, ctx);
2122 if (event_info) {
2123 /*
2124 * Do not allow monitoring the same wrapfd file
2125 * under different (dup'ed) FDs since that
2126 * would cause one wrapfd operation to generate
2127 * multiple events.
2128 */
2129 if (monitor->fd != event_info->fd) {
2130 results[i] = -EBUSY;
2131 goto unlock;
2132 }
2133 }
2134 if (add) {
2135 if (!event_info) {
2136 if (!tmp) {
2137 results[i] = -ENOMEM;
2138 goto unlock;
2139 }
2140 event_info = tmp;
2141 tmp = NULL;
2142 init_wrap_event_info(event_info, file_mon,
2143 ctx, monitor->fd);
2144 }
2145 event_info->monitored |= monitor->events;
2146 } else {
2147 if (event_info) {
2148 event_info->monitored &= ~monitor->events;
2149 if (!event_info->monitored)
2150 free_wrap_event_info(event_info);
2151 } else {
2152 results[i] = -EINVAL;
2153 }
2154 }
2155 unlock:
2156 spin_unlock(&file_mon->event_lock);
2157 spin_unlock(&ctx->lock);
2158 fdput(f);
2159 }
2160 kfree(tmp);
2161 if (copy_to_user((void __user *)monitors->results, results,
2162 monitors->len * sizeof(__u64)))
2163 ret = -EFAULT;
2164 free_res:
2165 kfree(results);
2166 free_arr:
2167 kfree(arr);
2168
2169 return ret;
2170 }
2171
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2026-11-07 9:15 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=202611071053.Pkp9bjCP-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.