include/linux/fortify-string.h:179:17: error: call to '__write_overflow' declared with attribute error: detected write beyond size of object (1st parameter)
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 136057256686de39cc3a07c2e39ef6bc43003ff6
commit: c430f60036af44079170ff71a461b9d7cf5ee431 fortify: Move remaining fortify helpers into fortify-string.h
date: 8 weeks ago
config: arm-randconfig-r011-20211123 (https://download.01.org/0day-ci/archive/20211124/202111240718.sP0LNt2k-lk...)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
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
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit...
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout c430f60036af44079170ff71a461b9d7cf5ee431
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm SHELL=/bin/bash drivers/scsi/qla2xxx/ net/smc/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
In file included from include/linux/string.h:253,
from include/linux/bitmap.h:10,
from include/linux/cpumask.h:12,
from include/linux/mm_types_task.h:14,
from include/linux/mm_types.h:5,
from include/linux/buildid.h:5,
from include/linux/module.h:14,
from drivers/scsi/qla2xxx/qla_def.h:12,
from drivers/scsi/qla2xxx/qla_mr.c:6:
In function 'memset',
inlined from 'qlafx00_start_scsi' at drivers/scsi/qla2xxx/qla_mr.c:3132:2:
>> include/linux/fortify-string.h:179:17: error: call to '__write_overflow' declared with attribute error: detected write beyond size of object (1st parameter)
179 | __write_overflow();
| ^~~~~~~~~~~~~~~~~~
In function 'memset',
inlined from 'qlafx00_fxdisc_iocb' at drivers/scsi/qla2xxx/qla_mr.c:3327:6:
>> include/linux/fortify-string.h:179:17: error: call to '__write_overflow' declared with attribute error: detected write beyond size of object (1st parameter)
179 | __write_overflow();
| ^~~~~~~~~~~~~~~~~~
--
In file included from <command-line>:
net/smc/smc_llc.c: In function 'smc_llc_add_pending_send':
include/linux/compiler_types.h:317:45: error: call to '__compiletime_assert_540' declared with attribute error: must increase SMC_WR_BUF_SIZE to at least sizeof(struct smc_llc_msg)
317 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^
include/linux/compiler_types.h:298:25: note: in definition of macro '__compiletime_assert'
298 | prefix ## suffix(); \
| ^~~~~~
include/linux/compiler_types.h:317:9: note: in expansion of macro '_compiletime_assert'
317 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
net/smc/smc_llc.c:365:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
365 | BUILD_BUG_ON_MSG(
| ^~~~~~~~~~~~~~~~
include/linux/compiler_types.h:317:45: error: call to '__compiletime_assert_541' declared with attribute error: must adapt SMC_WR_TX_SIZE to sizeof(struct smc_llc_msg); if not all smc_wr upper layer protocols use the same message size any more, must start to set link->wr_tx_sges[i].length on each individual smc_wr_tx_send()
317 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^
include/linux/compiler_types.h:298:25: note: in definition of macro '__compiletime_assert'
298 | prefix ## suffix(); \
| ^~~~~~
include/linux/compiler_types.h:317:9: note: in expansion of macro '_compiletime_assert'
317 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
net/smc/smc_llc.c:368:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
368 | BUILD_BUG_ON_MSG(
| ^~~~~~~~~~~~~~~~
In file included from include/linux/string.h:253,
from include/linux/bitmap.h:10,
from include/linux/cpumask.h:12,
from include/linux/smp.h:13,
from include/linux/lockdep.h:14,
from include/linux/spinlock.h:63,
from include/linux/wait.h:9,
from include/linux/wait_bit.h:8,
from include/linux/fs.h:6,
from include/linux/highmem.h:5,
from include/linux/bvec.h:10,
from include/linux/skbuff.h:17,
from include/linux/tcp.h:17,
from include/net/tcp.h:20,
from net/smc/smc_llc.c:13:
In function 'memcpy',
inlined from 'smc_llc_send_message_wait' at net/smc/smc_llc.c:594:2,
inlined from 'smc_llc_send_link_delete_all' at net/smc/smc_llc.c:1328:8:
>> include/linux/fortify-string.h:194:25: error: call to '__read_overflow2' declared with attribute error: detected read beyond size of object (2nd parameter)
194 | __read_overflow2();
| ^~~~~~~~~~~~~~~~~~
vim +/__write_overflow +179 include/linux/fortify-string.h
a28a6e860c6cf2 Francis Laniel 2021-02-25 173
a28a6e860c6cf2 Francis Laniel 2021-02-25 174 __FORTIFY_INLINE void *memset(void *p, int c, __kernel_size_t size)
a28a6e860c6cf2 Francis Laniel 2021-02-25 175 {
a28a6e860c6cf2 Francis Laniel 2021-02-25 176 size_t p_size = __builtin_object_size(p, 0);
a28a6e860c6cf2 Francis Laniel 2021-02-25 177
a28a6e860c6cf2 Francis Laniel 2021-02-25 178 if (__builtin_constant_p(size) && p_size < size)
a28a6e860c6cf2 Francis Laniel 2021-02-25 @179 __write_overflow();
a28a6e860c6cf2 Francis Laniel 2021-02-25 180 if (p_size < size)
a28a6e860c6cf2 Francis Laniel 2021-02-25 181 fortify_panic(__func__);
a28a6e860c6cf2 Francis Laniel 2021-02-25 182 return __underlying_memset(p, c, size);
a28a6e860c6cf2 Francis Laniel 2021-02-25 183 }
a28a6e860c6cf2 Francis Laniel 2021-02-25 184
a28a6e860c6cf2 Francis Laniel 2021-02-25 185 __FORTIFY_INLINE void *memcpy(void *p, const void *q, __kernel_size_t size)
a28a6e860c6cf2 Francis Laniel 2021-02-25 186 {
a28a6e860c6cf2 Francis Laniel 2021-02-25 187 size_t p_size = __builtin_object_size(p, 0);
a28a6e860c6cf2 Francis Laniel 2021-02-25 188 size_t q_size = __builtin_object_size(q, 0);
a28a6e860c6cf2 Francis Laniel 2021-02-25 189
a28a6e860c6cf2 Francis Laniel 2021-02-25 190 if (__builtin_constant_p(size)) {
a28a6e860c6cf2 Francis Laniel 2021-02-25 191 if (p_size < size)
a28a6e860c6cf2 Francis Laniel 2021-02-25 192 __write_overflow();
a28a6e860c6cf2 Francis Laniel 2021-02-25 193 if (q_size < size)
a28a6e860c6cf2 Francis Laniel 2021-02-25 @194 __read_overflow2();
a28a6e860c6cf2 Francis Laniel 2021-02-25 195 }
a28a6e860c6cf2 Francis Laniel 2021-02-25 196 if (p_size < size || q_size < size)
a28a6e860c6cf2 Francis Laniel 2021-02-25 197 fortify_panic(__func__);
a28a6e860c6cf2 Francis Laniel 2021-02-25 198 return __underlying_memcpy(p, q, size);
a28a6e860c6cf2 Francis Laniel 2021-02-25 199 }
a28a6e860c6cf2 Francis Laniel 2021-02-25 200
:::::: The code at line 179 was first introduced by commit
:::::: a28a6e860c6cf231cf3c5171c75c342adcd00406 string.h: move fortified functions definitions in a dedicated header.
:::::: TO: Francis Laniel <laniel_francis(a)privacyrequired.com>
:::::: CC: Linus Torvalds <torvalds(a)linux-foundation.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months
[android-common:android13-5.15 2/2] kernel/printk/printk.c:2167:4: error: implicit declaration of function 'trace_android_vh_logbuf_pr_cont'
by kernel test robot
tree: https://android.googlesource.com/kernel/common android13-5.15
head: 0820d8e399e81ff9f70cfc8d169f48596d7d3ed7
commit: 0820d8e399e81ff9f70cfc8d169f48596d7d3ed7 [2/2] ANDROID: logbuf: Add new logbuf vendor hook to support pr_cont()
config: arm64-randconfig-r016-20211123 (https://download.01.org/0day-ci/archive/20211124/202111240708.0Mm7kBD7-lk...)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 49e3838145dff1ec91c2e67a2cb562775c8d2a08)
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 arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
git remote add android-common https://android.googlesource.com/kernel/common
git fetch --no-tags android-common android13-5.15
git checkout 0820d8e399e81ff9f70cfc8d169f48596d7d3ed7
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=arm64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
>> kernel/printk/printk.c:2167:4: error: implicit declaration of function 'trace_android_vh_logbuf_pr_cont' [-Werror,-Wimplicit-function-declaration]
trace_android_vh_logbuf_pr_cont(&r, text_len);
^
1 error generated.
vim +/trace_android_vh_logbuf_pr_cont +2167 kernel/printk/printk.c
2099
2100 __printf(4, 0)
2101 int vprintk_store(int facility, int level,
2102 const struct dev_printk_info *dev_info,
2103 const char *fmt, va_list args)
2104 {
2105 const u32 caller_id = printk_caller_id();
2106 struct prb_reserved_entry e;
2107 enum printk_info_flags flags = 0;
2108 struct printk_record r;
2109 unsigned long irqflags;
2110 u16 trunc_msg_len = 0;
2111 char prefix_buf[8];
2112 u8 *recursion_ptr;
2113 u16 reserve_size;
2114 va_list args2;
2115 u16 text_len;
2116 int ret = 0;
2117 u64 ts_nsec;
2118
2119 /*
2120 * Since the duration of printk() can vary depending on the message
2121 * and state of the ringbuffer, grab the timestamp now so that it is
2122 * close to the call of printk(). This provides a more deterministic
2123 * timestamp with respect to the caller.
2124 */
2125 ts_nsec = local_clock();
2126
2127 if (!printk_enter_irqsave(recursion_ptr, irqflags))
2128 return 0;
2129
2130 /*
2131 * The sprintf needs to come first since the syslog prefix might be
2132 * passed in as a parameter. An extra byte must be reserved so that
2133 * later the vscnprintf() into the reserved buffer has room for the
2134 * terminating '\0', which is not counted by vsnprintf().
2135 */
2136 va_copy(args2, args);
2137 reserve_size = vsnprintf(&prefix_buf[0], sizeof(prefix_buf), fmt, args2) + 1;
2138 va_end(args2);
2139
2140 if (reserve_size > LOG_LINE_MAX)
2141 reserve_size = LOG_LINE_MAX;
2142
2143 /* Extract log level or control flags. */
2144 if (facility == 0)
2145 printk_parse_prefix(&prefix_buf[0], &level, &flags);
2146
2147 if (level == LOGLEVEL_DEFAULT)
2148 level = default_message_loglevel;
2149
2150 if (dev_info)
2151 flags |= LOG_NEWLINE;
2152
2153 if (flags & LOG_CONT) {
2154 prb_rec_init_wr(&r, reserve_size);
2155 if (prb_reserve_in_last(&e, prb, &r, caller_id, LOG_LINE_MAX)) {
2156 text_len = printk_sprint(&r.text_buf[r.info->text_len], reserve_size,
2157 facility, &flags, fmt, args);
2158 r.info->text_len += text_len;
2159
2160 if (flags & LOG_NEWLINE) {
2161 r.info->flags |= LOG_NEWLINE;
2162 prb_final_commit(&e);
2163 } else {
2164 prb_commit(&e);
2165 }
2166
> 2167 trace_android_vh_logbuf_pr_cont(&r, text_len);
2168 ret = text_len;
2169 goto out;
2170 }
2171 }
2172
2173 /*
2174 * Explicitly initialize the record before every prb_reserve() call.
2175 * prb_reserve_in_last() and prb_reserve() purposely invalidate the
2176 * structure when they fail.
2177 */
2178 prb_rec_init_wr(&r, reserve_size);
2179 if (!prb_reserve(&e, prb, &r)) {
2180 /* truncate the message if it is too long for empty buffer */
2181 truncate_msg(&reserve_size, &trunc_msg_len);
2182
2183 prb_rec_init_wr(&r, reserve_size + trunc_msg_len);
2184 if (!prb_reserve(&e, prb, &r))
2185 goto out;
2186 }
2187
2188 /* fill message */
2189 text_len = printk_sprint(&r.text_buf[0], reserve_size, facility, &flags, fmt, args);
2190 if (trunc_msg_len)
2191 memcpy(&r.text_buf[text_len], trunc_msg, trunc_msg_len);
2192 r.info->text_len = text_len + trunc_msg_len;
2193 r.info->facility = facility;
2194 r.info->level = level & 7;
2195 r.info->flags = flags & 0x1f;
2196 r.info->ts_nsec = ts_nsec;
2197 r.info->caller_id = caller_id;
2198 if (dev_info)
2199 memcpy(&r.info->dev_info, dev_info, sizeof(r.info->dev_info));
2200
2201 /* A message without a trailing newline can be continued. */
2202 if (!(flags & LOG_NEWLINE))
2203 prb_commit(&e);
2204 else
2205 prb_final_commit(&e);
2206
2207 trace_android_vh_logbuf(prb, &r);
2208 ret = text_len + trunc_msg_len;
2209 out:
2210 printk_exit_irqrestore(recursion_ptr, irqflags);
2211 return ret;
2212 }
2213
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months
Re: [PATCH 9/9] iommu: Move flush queue data into iommu_dma_cookie
by kernel test robot
Hi Robin,
I love your patch! Perhaps something to improve:
[auto build test WARNING on joro-iommu/next]
[also build test WARNING on v5.16-rc2 next-20211123]
[cannot apply to tegra-drm/drm/tegra/for-next]
[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/Robin-Murphy/iommu-Refactor-flus...
base: https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
config: arm-defconfig (https://download.01.org/0day-ci/archive/20211124/202111240645.30neUyaq-lk...)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
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
# https://github.com/0day-ci/linux/commit/d4623bb02366503fa7c3805228fa9534c...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Robin-Murphy/iommu-Refactor-flush-queues-into-iommu-dma/20211123-221220
git checkout d4623bb02366503fa7c3805228fa9534c9490d20
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
drivers/gpu/drm/tegra/vic.c: In function 'vic_exit':
drivers/gpu/drm/tegra/vic.c:196:17: error: implicit declaration of function 'dma_unmap_single'; did you mean 'mount_single'? [-Werror=implicit-function-declaration]
196 | dma_unmap_single(vic->dev, vic->falcon.firmware.phys,
| ^~~~~~~~~~~~~~~~
| mount_single
drivers/gpu/drm/tegra/vic.c:197:61: error: 'DMA_TO_DEVICE' undeclared (first use in this function); did you mean 'MT_DEVICE'?
197 | vic->falcon.firmware.size, DMA_TO_DEVICE);
| ^~~~~~~~~~~~~
| MT_DEVICE
drivers/gpu/drm/tegra/vic.c:197:61: note: each undeclared identifier is reported only once for each function it appears in
drivers/gpu/drm/tegra/vic.c:202:17: error: implicit declaration of function 'dma_free_coherent' [-Werror=implicit-function-declaration]
202 | dma_free_coherent(vic->dev, vic->falcon.firmware.size,
| ^~~~~~~~~~~~~~~~~
drivers/gpu/drm/tegra/vic.c: In function 'vic_load_firmware':
drivers/gpu/drm/tegra/vic.c:234:24: error: implicit declaration of function 'dma_alloc_coherent' [-Werror=implicit-function-declaration]
234 | virt = dma_alloc_coherent(vic->dev, size, &iova, GFP_KERNEL);
| ^~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/tegra/vic.c:234:22: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
234 | virt = dma_alloc_coherent(vic->dev, size, &iova, GFP_KERNEL);
| ^
drivers/gpu/drm/tegra/vic.c:236:23: error: implicit declaration of function 'dma_mapping_error' [-Werror=implicit-function-declaration]
236 | err = dma_mapping_error(vic->dev, iova);
| ^~~~~~~~~~~~~~~~~
drivers/gpu/drm/tegra/vic.c:258:24: error: implicit declaration of function 'dma_map_single' [-Werror=implicit-function-declaration]
258 | phys = dma_map_single(vic->dev, virt, size, DMA_TO_DEVICE);
| ^~~~~~~~~~~~~~
drivers/gpu/drm/tegra/vic.c:258:61: error: 'DMA_TO_DEVICE' undeclared (first use in this function); did you mean 'MT_DEVICE'?
258 | phys = dma_map_single(vic->dev, virt, size, DMA_TO_DEVICE);
| ^~~~~~~~~~~~~
| MT_DEVICE
drivers/gpu/drm/tegra/vic.c: In function 'vic_probe':
drivers/gpu/drm/tegra/vic.c:412:15: error: implicit declaration of function 'dma_coerce_mask_and_coherent' [-Werror=implicit-function-declaration]
412 | err = dma_coerce_mask_and_coherent(dev, *dev->parent->dma_mask);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +234 drivers/gpu/drm/tegra/vic.c
0ae797a8ba05a2 Arto Merilainen 2016-12-14 214
77a0b09dd993c8 Thierry Reding 2019-02-01 215 static int vic_load_firmware(struct vic *vic)
77a0b09dd993c8 Thierry Reding 2019-02-01 216 {
20e7dce255e96a Thierry Reding 2019-10-28 217 struct host1x_client *client = &vic->client.base;
20e7dce255e96a Thierry Reding 2019-10-28 218 struct tegra_drm *tegra = vic->client.drm;
d972d624762805 Thierry Reding 2019-10-28 219 dma_addr_t iova;
20e7dce255e96a Thierry Reding 2019-10-28 220 size_t size;
20e7dce255e96a Thierry Reding 2019-10-28 221 void *virt;
77a0b09dd993c8 Thierry Reding 2019-02-01 222 int err;
77a0b09dd993c8 Thierry Reding 2019-02-01 223
d972d624762805 Thierry Reding 2019-10-28 224 if (vic->falcon.firmware.virt)
77a0b09dd993c8 Thierry Reding 2019-02-01 225 return 0;
77a0b09dd993c8 Thierry Reding 2019-02-01 226
77a0b09dd993c8 Thierry Reding 2019-02-01 227 err = falcon_read_firmware(&vic->falcon, vic->config->firmware);
77a0b09dd993c8 Thierry Reding 2019-02-01 228 if (err < 0)
20e7dce255e96a Thierry Reding 2019-10-28 229 return err;
20e7dce255e96a Thierry Reding 2019-10-28 230
20e7dce255e96a Thierry Reding 2019-10-28 231 size = vic->falcon.firmware.size;
20e7dce255e96a Thierry Reding 2019-10-28 232
20e7dce255e96a Thierry Reding 2019-10-28 233 if (!client->group) {
d972d624762805 Thierry Reding 2019-10-28 @234 virt = dma_alloc_coherent(vic->dev, size, &iova, GFP_KERNEL);
20e7dce255e96a Thierry Reding 2019-10-28 235
d972d624762805 Thierry Reding 2019-10-28 236 err = dma_mapping_error(vic->dev, iova);
20e7dce255e96a Thierry Reding 2019-10-28 237 if (err < 0)
20e7dce255e96a Thierry Reding 2019-10-28 238 return err;
20e7dce255e96a Thierry Reding 2019-10-28 239 } else {
d972d624762805 Thierry Reding 2019-10-28 240 virt = tegra_drm_alloc(tegra, size, &iova);
20e7dce255e96a Thierry Reding 2019-10-28 241 }
20e7dce255e96a Thierry Reding 2019-10-28 242
d972d624762805 Thierry Reding 2019-10-28 243 vic->falcon.firmware.virt = virt;
d972d624762805 Thierry Reding 2019-10-28 244 vic->falcon.firmware.iova = iova;
77a0b09dd993c8 Thierry Reding 2019-02-01 245
77a0b09dd993c8 Thierry Reding 2019-02-01 246 err = falcon_load_firmware(&vic->falcon);
77a0b09dd993c8 Thierry Reding 2019-02-01 247 if (err < 0)
77a0b09dd993c8 Thierry Reding 2019-02-01 248 goto cleanup;
77a0b09dd993c8 Thierry Reding 2019-02-01 249
20e7dce255e96a Thierry Reding 2019-10-28 250 /*
20e7dce255e96a Thierry Reding 2019-10-28 251 * In this case we have received an IOVA from the shared domain, so we
20e7dce255e96a Thierry Reding 2019-10-28 252 * need to make sure to get the physical address so that the DMA API
20e7dce255e96a Thierry Reding 2019-10-28 253 * knows what memory pages to flush the cache for.
20e7dce255e96a Thierry Reding 2019-10-28 254 */
20e7dce255e96a Thierry Reding 2019-10-28 255 if (client->group) {
d972d624762805 Thierry Reding 2019-10-28 256 dma_addr_t phys;
d972d624762805 Thierry Reding 2019-10-28 257
20e7dce255e96a Thierry Reding 2019-10-28 258 phys = dma_map_single(vic->dev, virt, size, DMA_TO_DEVICE);
20e7dce255e96a Thierry Reding 2019-10-28 259
20e7dce255e96a Thierry Reding 2019-10-28 260 err = dma_mapping_error(vic->dev, phys);
20e7dce255e96a Thierry Reding 2019-10-28 261 if (err < 0)
20e7dce255e96a Thierry Reding 2019-10-28 262 goto cleanup;
20e7dce255e96a Thierry Reding 2019-10-28 263
d972d624762805 Thierry Reding 2019-10-28 264 vic->falcon.firmware.phys = phys;
20e7dce255e96a Thierry Reding 2019-10-28 265 }
20e7dce255e96a Thierry Reding 2019-10-28 266
77a0b09dd993c8 Thierry Reding 2019-02-01 267 return 0;
77a0b09dd993c8 Thierry Reding 2019-02-01 268
77a0b09dd993c8 Thierry Reding 2019-02-01 269 cleanup:
20e7dce255e96a Thierry Reding 2019-10-28 270 if (!client->group)
d972d624762805 Thierry Reding 2019-10-28 271 dma_free_coherent(vic->dev, size, virt, iova);
20e7dce255e96a Thierry Reding 2019-10-28 272 else
d972d624762805 Thierry Reding 2019-10-28 273 tegra_drm_free(tegra, size, virt, iova);
20e7dce255e96a Thierry Reding 2019-10-28 274
77a0b09dd993c8 Thierry Reding 2019-02-01 275 return err;
77a0b09dd993c8 Thierry Reding 2019-02-01 276 }
77a0b09dd993c8 Thierry Reding 2019-02-01 277
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months
[android-common:android13-5.15 2/2] kernel/printk/printk.c:2167:4: error: implicit declaration of function 'trace_android_vh_logbuf_pr_cont'; did you mean 'trace_android_vh_logbuf'?
by kernel test robot
tree: https://android.googlesource.com/kernel/common android13-5.15
head: 0820d8e399e81ff9f70cfc8d169f48596d7d3ed7
commit: 0820d8e399e81ff9f70cfc8d169f48596d7d3ed7 [2/2] ANDROID: logbuf: Add new logbuf vendor hook to support pr_cont()
config: i386-defconfig (https://download.01.org/0day-ci/archive/20211124/202111240531.hOaDqBP8-lk...)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
git remote add android-common https://android.googlesource.com/kernel/common
git fetch --no-tags android-common android13-5.15
git checkout 0820d8e399e81ff9f70cfc8d169f48596d7d3ed7
# save the config file to linux build tree
make W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
kernel/printk/printk.c: In function 'printk_sprint':
kernel/printk/printk.c:2078:2: warning: function 'printk_sprint' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
2078 | text_len = vscnprintf(text, size, fmt, args);
| ^~~~~~~~
kernel/printk/printk.c: In function 'vprintk_store':
>> kernel/printk/printk.c:2167:4: error: implicit declaration of function 'trace_android_vh_logbuf_pr_cont'; did you mean 'trace_android_vh_logbuf'? [-Werror=implicit-function-declaration]
2167 | trace_android_vh_logbuf_pr_cont(&r, text_len);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| trace_android_vh_logbuf
cc1: some warnings being treated as errors
vim +2167 kernel/printk/printk.c
2071
2072 static u16 printk_sprint(char *text, u16 size, int facility,
2073 enum printk_info_flags *flags, const char *fmt,
2074 va_list args)
2075 {
2076 u16 text_len;
2077
> 2078 text_len = vscnprintf(text, size, fmt, args);
2079
2080 /* Mark and strip a trailing newline. */
2081 if (text_len && text[text_len - 1] == '\n') {
2082 text_len--;
2083 *flags |= LOG_NEWLINE;
2084 }
2085
2086 /* Strip log level and control flags. */
2087 if (facility == 0) {
2088 u16 prefix_len;
2089
2090 prefix_len = printk_parse_prefix(text, NULL, NULL);
2091 if (prefix_len) {
2092 text_len -= prefix_len;
2093 memmove(text, text + prefix_len, text_len);
2094 }
2095 }
2096
2097 return text_len;
2098 }
2099
2100 __printf(4, 0)
2101 int vprintk_store(int facility, int level,
2102 const struct dev_printk_info *dev_info,
2103 const char *fmt, va_list args)
2104 {
2105 const u32 caller_id = printk_caller_id();
2106 struct prb_reserved_entry e;
2107 enum printk_info_flags flags = 0;
2108 struct printk_record r;
2109 unsigned long irqflags;
2110 u16 trunc_msg_len = 0;
2111 char prefix_buf[8];
2112 u8 *recursion_ptr;
2113 u16 reserve_size;
2114 va_list args2;
2115 u16 text_len;
2116 int ret = 0;
2117 u64 ts_nsec;
2118
2119 /*
2120 * Since the duration of printk() can vary depending on the message
2121 * and state of the ringbuffer, grab the timestamp now so that it is
2122 * close to the call of printk(). This provides a more deterministic
2123 * timestamp with respect to the caller.
2124 */
2125 ts_nsec = local_clock();
2126
2127 if (!printk_enter_irqsave(recursion_ptr, irqflags))
2128 return 0;
2129
2130 /*
2131 * The sprintf needs to come first since the syslog prefix might be
2132 * passed in as a parameter. An extra byte must be reserved so that
2133 * later the vscnprintf() into the reserved buffer has room for the
2134 * terminating '\0', which is not counted by vsnprintf().
2135 */
2136 va_copy(args2, args);
2137 reserve_size = vsnprintf(&prefix_buf[0], sizeof(prefix_buf), fmt, args2) + 1;
2138 va_end(args2);
2139
2140 if (reserve_size > LOG_LINE_MAX)
2141 reserve_size = LOG_LINE_MAX;
2142
2143 /* Extract log level or control flags. */
2144 if (facility == 0)
2145 printk_parse_prefix(&prefix_buf[0], &level, &flags);
2146
2147 if (level == LOGLEVEL_DEFAULT)
2148 level = default_message_loglevel;
2149
2150 if (dev_info)
2151 flags |= LOG_NEWLINE;
2152
2153 if (flags & LOG_CONT) {
2154 prb_rec_init_wr(&r, reserve_size);
2155 if (prb_reserve_in_last(&e, prb, &r, caller_id, LOG_LINE_MAX)) {
2156 text_len = printk_sprint(&r.text_buf[r.info->text_len], reserve_size,
2157 facility, &flags, fmt, args);
2158 r.info->text_len += text_len;
2159
2160 if (flags & LOG_NEWLINE) {
2161 r.info->flags |= LOG_NEWLINE;
2162 prb_final_commit(&e);
2163 } else {
2164 prb_commit(&e);
2165 }
2166
> 2167 trace_android_vh_logbuf_pr_cont(&r, text_len);
2168 ret = text_len;
2169 goto out;
2170 }
2171 }
2172
2173 /*
2174 * Explicitly initialize the record before every prb_reserve() call.
2175 * prb_reserve_in_last() and prb_reserve() purposely invalidate the
2176 * structure when they fail.
2177 */
2178 prb_rec_init_wr(&r, reserve_size);
2179 if (!prb_reserve(&e, prb, &r)) {
2180 /* truncate the message if it is too long for empty buffer */
2181 truncate_msg(&reserve_size, &trunc_msg_len);
2182
2183 prb_rec_init_wr(&r, reserve_size + trunc_msg_len);
2184 if (!prb_reserve(&e, prb, &r))
2185 goto out;
2186 }
2187
2188 /* fill message */
2189 text_len = printk_sprint(&r.text_buf[0], reserve_size, facility, &flags, fmt, args);
2190 if (trunc_msg_len)
2191 memcpy(&r.text_buf[text_len], trunc_msg, trunc_msg_len);
2192 r.info->text_len = text_len + trunc_msg_len;
2193 r.info->facility = facility;
2194 r.info->level = level & 7;
2195 r.info->flags = flags & 0x1f;
2196 r.info->ts_nsec = ts_nsec;
2197 r.info->caller_id = caller_id;
2198 if (dev_info)
2199 memcpy(&r.info->dev_info, dev_info, sizeof(r.info->dev_info));
2200
2201 /* A message without a trailing newline can be continued. */
2202 if (!(flags & LOG_NEWLINE))
2203 prb_commit(&e);
2204 else
2205 prb_final_commit(&e);
2206
2207 trace_android_vh_logbuf(prb, &r);
2208 ret = text_len + trunc_msg_len;
2209 out:
2210 printk_exit_irqrestore(recursion_ptr, irqflags);
2211 return ret;
2212 }
2213
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months
mm/memory.c:709:25: sparse: sparse: cast to non-scalar
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 136057256686de39cc3a07c2e39ef6bc43003ff6
commit: b756a3b5e7ead8f6f4b03cea8ac22478ce04c8a8 mm: device exclusive memory access
date: 5 months ago
config: alpha-randconfig-s031-20211122 (https://download.01.org/0day-ci/archive/20211124/202111240450.3z7aF31U-lk...)
compiler: alpha-linux-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit...
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout b756a3b5e7ead8f6f4b03cea8ac22478ce04c8a8
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=alpha SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
>> mm/memory.c:709:25: sparse: sparse: cast to non-scalar
>> mm/memory.c:709:25: sparse: sparse: cast from non-scalar
mm/memory.c:1023:17: sparse: sparse: context imbalance in 'copy_pte_range' - different lock contexts for basic block
mm/memory.c:1736:16: sparse: sparse: context imbalance in '__get_locked_pte' - different lock contexts for basic block
mm/memory.c:1785:9: sparse: sparse: context imbalance in 'insert_page' - different lock contexts for basic block
mm/memory.c:2287:17: sparse: sparse: context imbalance in 'remap_pte_range' - different lock contexts for basic block
mm/memory.c:2543:17: sparse: sparse: context imbalance in 'apply_to_pte_range' - unexpected unlock
mm/memory.c:2831:17: sparse: sparse: context imbalance in 'wp_page_copy' - unexpected unlock
mm/memory.c:3180:17: sparse: sparse: context imbalance in 'wp_pfn_shared' - unexpected unlock
mm/memory.c:3243:19: sparse: sparse: context imbalance in 'do_wp_page' - different lock contexts for basic block
mm/memory.c: note: in included file (through include/linux/mm.h, arch/alpha/include/asm/io.h, include/linux/io.h, include/linux/irq.h, ...):
include/linux/pgtable.h:275:16: sparse: sparse: cast to non-scalar
include/linux/pgtable.h:275:16: sparse: sparse: cast from non-scalar
mm/memory.c:4874:5: sparse: sparse: context imbalance in 'follow_invalidate_pte' - different lock contexts for basic block
mm/memory.c:4995:9: sparse: sparse: context imbalance in 'follow_pfn' - unexpected unlock
vim +709 mm/memory.c
701
702 static void restore_exclusive_pte(struct vm_area_struct *vma,
703 struct page *page, unsigned long address,
704 pte_t *ptep)
705 {
706 pte_t pte;
707 swp_entry_t entry;
708
> 709 pte = pte_mkold(mk_pte(page, READ_ONCE(vma->vm_page_prot)));
710 if (pte_swp_soft_dirty(*ptep))
711 pte = pte_mksoft_dirty(pte);
712
713 entry = pte_to_swp_entry(*ptep);
714 if (pte_swp_uffd_wp(*ptep))
715 pte = pte_mkuffd_wp(pte);
716 else if (is_writable_device_exclusive_entry(entry))
717 pte = maybe_mkwrite(pte_mkdirty(pte), vma);
718
719 set_pte_at(vma->vm_mm, address, ptep, pte);
720
721 /*
722 * No need to take a page reference as one was already
723 * created when the swap entry was made.
724 */
725 if (PageAnon(page))
726 page_add_anon_rmap(page, vma, address, false);
727 else
728 /*
729 * Currently device exclusive access only supports anonymous
730 * memory so the entry shouldn't point to a filebacked page.
731 */
732 WARN_ON_ONCE(!PageAnon(page));
733
734 if (vma->vm_flags & VM_LOCKED)
735 mlock_vma_page(page);
736
737 /*
738 * No need to invalidate - it was non-present before. However
739 * secondary CPUs may have mappings that need invalidating.
740 */
741 update_mmu_cache(vma, address, ptep);
742 }
743
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months
Re: [PATCH v2 3/5] uaccess-buffer: add CONFIG_GENERIC_ENTRY support
by kernel test robot
Hi Peter,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on tip/sched/core]
[also build test WARNING on bpf-next/master bpf/master linus/master v5.16-rc2]
[cannot apply to arm64/for-next/core arm-perf/for-next/perf tip/core/entry next-20211123]
[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/Peter-Collingbourne/kernel-intro...
base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git cb0e52b7748737b2cf6481fdd9b920ce7e1ebbdf
config: x86_64-randconfig-s021-20211123 (https://download.01.org/0day-ci/archive/20211124/202111240417.oXKdhwgK-lk...)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://github.com/0day-ci/linux/commit/7cd6f102201f3ea35eea1b990f7543e89...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Peter-Collingbourne/kernel-introduce-uaccess-logging/20211123-131922
git checkout 7cd6f102201f3ea35eea1b990f7543e890b7fdbb
# save the config file to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
>> kernel/uaccess-buffer.c:32:29: sparse: sparse: Using plain integer as NULL pointer
>> kernel/uaccess-buffer.c:72:31: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
kernel/uaccess-buffer.c:72:31: sparse: expected struct spinlock [usertype] *lock
kernel/uaccess-buffer.c:72:31: sparse: got struct spinlock [noderef] __rcu *
kernel/uaccess-buffer.c:75:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
kernel/uaccess-buffer.c:75:33: sparse: expected struct spinlock [usertype] *lock
kernel/uaccess-buffer.c:75:33: sparse: got struct spinlock [noderef] __rcu *
kernel/uaccess-buffer.c:83:29: sparse: sparse: Using plain integer as NULL pointer
kernel/uaccess-buffer.c:94:13: sparse: sparse: Using plain integer as NULL pointer
>> kernel/uaccess-buffer.c:117:22: sparse: sparse: cast removes address space '__user' of expression
kernel/uaccess-buffer.c:119:21: sparse: sparse: Using plain integer as NULL pointer
vim +32 kernel/uaccess-buffer.c
e050ed271bb0008 Peter Collingbourne 2021-11-22 17
e050ed271bb0008 Peter Collingbourne 2021-11-22 18 static void uaccess_buffer_log(unsigned long addr, unsigned long size,
e050ed271bb0008 Peter Collingbourne 2021-11-22 19 unsigned long flags)
e050ed271bb0008 Peter Collingbourne 2021-11-22 20 {
e050ed271bb0008 Peter Collingbourne 2021-11-22 21 struct uaccess_buffer_info *buf = ¤t->uaccess_buffer;
e050ed271bb0008 Peter Collingbourne 2021-11-22 22 struct uaccess_buffer_entry *entry = buf->kcur;
e050ed271bb0008 Peter Collingbourne 2021-11-22 23
e050ed271bb0008 Peter Collingbourne 2021-11-22 24 if (!entry || unlikely(uaccess_kernel()))
e050ed271bb0008 Peter Collingbourne 2021-11-22 25 return;
e050ed271bb0008 Peter Collingbourne 2021-11-22 26 entry->addr = addr;
e050ed271bb0008 Peter Collingbourne 2021-11-22 27 entry->size = size;
e050ed271bb0008 Peter Collingbourne 2021-11-22 28 entry->flags = flags;
e050ed271bb0008 Peter Collingbourne 2021-11-22 29
e050ed271bb0008 Peter Collingbourne 2021-11-22 30 ++buf->kcur;
e050ed271bb0008 Peter Collingbourne 2021-11-22 31 if (buf->kcur == buf->kend)
e050ed271bb0008 Peter Collingbourne 2021-11-22 @32 buf->kcur = 0;
e050ed271bb0008 Peter Collingbourne 2021-11-22 33 }
e050ed271bb0008 Peter Collingbourne 2021-11-22 34
e050ed271bb0008 Peter Collingbourne 2021-11-22 35 void uaccess_buffer_log_read(const void __user *from, unsigned long n)
e050ed271bb0008 Peter Collingbourne 2021-11-22 36 {
e050ed271bb0008 Peter Collingbourne 2021-11-22 37 uaccess_buffer_log((unsigned long)from, n, 0);
e050ed271bb0008 Peter Collingbourne 2021-11-22 38 }
e050ed271bb0008 Peter Collingbourne 2021-11-22 39 EXPORT_SYMBOL(uaccess_buffer_log_read);
e050ed271bb0008 Peter Collingbourne 2021-11-22 40
e050ed271bb0008 Peter Collingbourne 2021-11-22 41 void uaccess_buffer_log_write(void __user *to, unsigned long n)
e050ed271bb0008 Peter Collingbourne 2021-11-22 42 {
e050ed271bb0008 Peter Collingbourne 2021-11-22 43 uaccess_buffer_log((unsigned long)to, n, UACCESS_BUFFER_FLAG_WRITE);
e050ed271bb0008 Peter Collingbourne 2021-11-22 44 }
e050ed271bb0008 Peter Collingbourne 2021-11-22 45 EXPORT_SYMBOL(uaccess_buffer_log_write);
e050ed271bb0008 Peter Collingbourne 2021-11-22 46
e050ed271bb0008 Peter Collingbourne 2021-11-22 47 int uaccess_buffer_set_descriptor_addr_addr(unsigned long addr)
e050ed271bb0008 Peter Collingbourne 2021-11-22 48 {
e050ed271bb0008 Peter Collingbourne 2021-11-22 49 current->uaccess_buffer.desc_ptr_ptr =
e050ed271bb0008 Peter Collingbourne 2021-11-22 50 (struct uaccess_descriptor __user * __user *)addr;
e050ed271bb0008 Peter Collingbourne 2021-11-22 51 uaccess_buffer_cancel_log(current);
e050ed271bb0008 Peter Collingbourne 2021-11-22 52 return 0;
e050ed271bb0008 Peter Collingbourne 2021-11-22 53 }
e050ed271bb0008 Peter Collingbourne 2021-11-22 54
e050ed271bb0008 Peter Collingbourne 2021-11-22 55 bool __uaccess_buffer_pre_exit_loop(void)
e050ed271bb0008 Peter Collingbourne 2021-11-22 56 {
e050ed271bb0008 Peter Collingbourne 2021-11-22 57 struct uaccess_buffer_info *buf = ¤t->uaccess_buffer;
e050ed271bb0008 Peter Collingbourne 2021-11-22 58 struct uaccess_descriptor __user *desc_ptr;
e050ed271bb0008 Peter Collingbourne 2021-11-22 59 sigset_t tmp_mask;
e050ed271bb0008 Peter Collingbourne 2021-11-22 60
e050ed271bb0008 Peter Collingbourne 2021-11-22 61 if (get_user(desc_ptr, buf->desc_ptr_ptr) || !desc_ptr)
e050ed271bb0008 Peter Collingbourne 2021-11-22 62 return false;
e050ed271bb0008 Peter Collingbourne 2021-11-22 63
e050ed271bb0008 Peter Collingbourne 2021-11-22 64 current->real_blocked = current->blocked;
e050ed271bb0008 Peter Collingbourne 2021-11-22 65 sigfillset(&tmp_mask);
e050ed271bb0008 Peter Collingbourne 2021-11-22 66 set_current_blocked(&tmp_mask);
e050ed271bb0008 Peter Collingbourne 2021-11-22 67 return true;
e050ed271bb0008 Peter Collingbourne 2021-11-22 68 }
e050ed271bb0008 Peter Collingbourne 2021-11-22 69
e050ed271bb0008 Peter Collingbourne 2021-11-22 70 void __uaccess_buffer_post_exit_loop(void)
e050ed271bb0008 Peter Collingbourne 2021-11-22 71 {
e050ed271bb0008 Peter Collingbourne 2021-11-22 @72 spin_lock_irq(¤t->sighand->siglock);
e050ed271bb0008 Peter Collingbourne 2021-11-22 73 current->blocked = current->real_blocked;
e050ed271bb0008 Peter Collingbourne 2021-11-22 74 recalc_sigpending();
e050ed271bb0008 Peter Collingbourne 2021-11-22 75 spin_unlock_irq(¤t->sighand->siglock);
e050ed271bb0008 Peter Collingbourne 2021-11-22 76 }
e050ed271bb0008 Peter Collingbourne 2021-11-22 77
e050ed271bb0008 Peter Collingbourne 2021-11-22 78 void uaccess_buffer_cancel_log(struct task_struct *tsk)
e050ed271bb0008 Peter Collingbourne 2021-11-22 79 {
e050ed271bb0008 Peter Collingbourne 2021-11-22 80 struct uaccess_buffer_info *buf = &tsk->uaccess_buffer;
e050ed271bb0008 Peter Collingbourne 2021-11-22 81
e050ed271bb0008 Peter Collingbourne 2021-11-22 82 if (buf->kcur) {
e050ed271bb0008 Peter Collingbourne 2021-11-22 83 buf->kcur = 0;
e050ed271bb0008 Peter Collingbourne 2021-11-22 84 kfree(buf->kbegin);
e050ed271bb0008 Peter Collingbourne 2021-11-22 85 }
e050ed271bb0008 Peter Collingbourne 2021-11-22 86 }
e050ed271bb0008 Peter Collingbourne 2021-11-22 87
e050ed271bb0008 Peter Collingbourne 2021-11-22 88 void __uaccess_buffer_syscall_entry(void)
e050ed271bb0008 Peter Collingbourne 2021-11-22 89 {
e050ed271bb0008 Peter Collingbourne 2021-11-22 90 struct uaccess_buffer_info *buf = ¤t->uaccess_buffer;
e050ed271bb0008 Peter Collingbourne 2021-11-22 91 struct uaccess_descriptor desc;
e050ed271bb0008 Peter Collingbourne 2021-11-22 92
e050ed271bb0008 Peter Collingbourne 2021-11-22 93 if (get_user(buf->desc_ptr, buf->desc_ptr_ptr) || !buf->desc_ptr ||
e050ed271bb0008 Peter Collingbourne 2021-11-22 94 put_user(0, buf->desc_ptr_ptr) ||
e050ed271bb0008 Peter Collingbourne 2021-11-22 95 copy_from_user(&desc, buf->desc_ptr, sizeof(desc)))
e050ed271bb0008 Peter Collingbourne 2021-11-22 96 return;
e050ed271bb0008 Peter Collingbourne 2021-11-22 97
e050ed271bb0008 Peter Collingbourne 2021-11-22 98 if (desc.size > 1024)
e050ed271bb0008 Peter Collingbourne 2021-11-22 99 desc.size = 1024;
e050ed271bb0008 Peter Collingbourne 2021-11-22 100
e050ed271bb0008 Peter Collingbourne 2021-11-22 101 buf->kbegin = kmalloc_array(
e050ed271bb0008 Peter Collingbourne 2021-11-22 102 desc.size, sizeof(struct uaccess_buffer_entry), GFP_KERNEL);
e050ed271bb0008 Peter Collingbourne 2021-11-22 103 buf->kcur = buf->kbegin;
e050ed271bb0008 Peter Collingbourne 2021-11-22 104 buf->kend = buf->kbegin + desc.size;
e050ed271bb0008 Peter Collingbourne 2021-11-22 105 buf->ubegin = (struct uaccess_buffer_entry __user *)desc.addr;
e050ed271bb0008 Peter Collingbourne 2021-11-22 106 }
e050ed271bb0008 Peter Collingbourne 2021-11-22 107
e050ed271bb0008 Peter Collingbourne 2021-11-22 108 void __uaccess_buffer_syscall_exit(void)
e050ed271bb0008 Peter Collingbourne 2021-11-22 109 {
e050ed271bb0008 Peter Collingbourne 2021-11-22 110 struct uaccess_buffer_info *buf = ¤t->uaccess_buffer;
e050ed271bb0008 Peter Collingbourne 2021-11-22 111 u64 num_entries = buf->kcur - buf->kbegin;
e050ed271bb0008 Peter Collingbourne 2021-11-22 112 struct uaccess_descriptor desc;
e050ed271bb0008 Peter Collingbourne 2021-11-22 113
e050ed271bb0008 Peter Collingbourne 2021-11-22 114 if (!buf->kcur)
e050ed271bb0008 Peter Collingbourne 2021-11-22 115 return;
e050ed271bb0008 Peter Collingbourne 2021-11-22 116
e050ed271bb0008 Peter Collingbourne 2021-11-22 @117 desc.addr = (u64)(buf->ubegin + num_entries);
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months