* [robertosassu:ima-snapshots-v1-devel-v1 1/1] security/integrity/ima/ima_fs.c:321 ima_measurements_snap_write() warn: maybe return -EFAULT instead of the bytes remaining?
@ 2025-11-19 11:46 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2025-11-16 21:05 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp, Dan Carpenter
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Roberto Sassu <roberto.sassu@huawei.com>
tree: https://github.com/robertosassu/linux ima-snapshots-v1-devel-v1
head: b0bd002b6caa9d5d4f4d0db2a041b1fd91f33f8a
commit: b0bd002b6caa9d5d4f4d0db2a041b1fd91f33f8a [1/1] ima: Add support for measurement list snapshots
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: i386-randconfig-141-20251116 (https://download.01.org/0day-ci/archive/20251117/202511170428.8scOuqUb-lkp@intel.com/config)
compiler: gcc-13 (Debian 13.3.0-16) 13.3.0
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>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202511170428.8scOuqUb-lkp@intel.com/
smatch warnings:
security/integrity/ima/ima_fs.c:321 ima_measurements_snap_write() warn: maybe return -EFAULT instead of the bytes remaining?
vim +321 security/integrity/ima/ima_fs.c
b0bd002b6caa9d Roberto Sassu 2025-11-13 308
b0bd002b6caa9d Roberto Sassu 2025-11-13 309 static ssize_t ima_measurements_snap_write(struct file *file,
b0bd002b6caa9d Roberto Sassu 2025-11-13 310 const char __user *buf,
b0bd002b6caa9d Roberto Sassu 2025-11-13 311 size_t datalen, loff_t *ppos)
b0bd002b6caa9d Roberto Sassu 2025-11-13 312 {
b0bd002b6caa9d Roberto Sassu 2025-11-13 313 unsigned char req[SNAPSHOT_REQ_LENGTH];
b0bd002b6caa9d Roberto Sassu 2025-11-13 314 int ret;
b0bd002b6caa9d Roberto Sassu 2025-11-13 315
b0bd002b6caa9d Roberto Sassu 2025-11-13 316 if (*ppos > 0 || datalen != SNAPSHOT_REQ_LENGTH)
b0bd002b6caa9d Roberto Sassu 2025-11-13 317 return -EINVAL;
b0bd002b6caa9d Roberto Sassu 2025-11-13 318
b0bd002b6caa9d Roberto Sassu 2025-11-13 319 ret = copy_from_user(req, buf, datalen);
b0bd002b6caa9d Roberto Sassu 2025-11-13 320 if (ret < 0)
b0bd002b6caa9d Roberto Sassu 2025-11-13 @321 return ret;
b0bd002b6caa9d Roberto Sassu 2025-11-13 322
b0bd002b6caa9d Roberto Sassu 2025-11-13 323 if (req[1] != '\n')
b0bd002b6caa9d Roberto Sassu 2025-11-13 324 return -EINVAL;
b0bd002b6caa9d Roberto Sassu 2025-11-13 325
b0bd002b6caa9d Roberto Sassu 2025-11-13 326 switch (req[0]) {
b0bd002b6caa9d Roberto Sassu 2025-11-13 327 case SNAPSHOT_REQ_MAKE:
b0bd002b6caa9d Roberto Sassu 2025-11-13 328 ret = ima_queue_make_snapshot();
b0bd002b6caa9d Roberto Sassu 2025-11-13 329 break;
b0bd002b6caa9d Roberto Sassu 2025-11-13 330 case SNAPSHOT_REQ_DEL:
b0bd002b6caa9d Roberto Sassu 2025-11-13 331 ret = ima_queue_delete_snapshot();
b0bd002b6caa9d Roberto Sassu 2025-11-13 332 break;
b0bd002b6caa9d Roberto Sassu 2025-11-13 333 default:
b0bd002b6caa9d Roberto Sassu 2025-11-13 334 ret = -EINVAL;
b0bd002b6caa9d Roberto Sassu 2025-11-13 335 break;
b0bd002b6caa9d Roberto Sassu 2025-11-13 336 }
b0bd002b6caa9d Roberto Sassu 2025-11-13 337
b0bd002b6caa9d Roberto Sassu 2025-11-13 338 if (ret < 0)
b0bd002b6caa9d Roberto Sassu 2025-11-13 339 return ret;
b0bd002b6caa9d Roberto Sassu 2025-11-13 340
b0bd002b6caa9d Roberto Sassu 2025-11-13 341 return datalen;
b0bd002b6caa9d Roberto Sassu 2025-11-13 342 }
b0bd002b6caa9d Roberto Sassu 2025-11-13 343
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
* [robertosassu:ima-snapshots-v1-devel-v1 1/1] security/integrity/ima/ima_fs.c:321 ima_measurements_snap_write() warn: maybe return -EFAULT instead of the bytes remaining?
@ 2025-11-19 11:46 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2025-11-19 11:46 UTC (permalink / raw)
To: oe-kbuild, Roberto Sassu; +Cc: lkp, oe-kbuild-all
tree: https://github.com/robertosassu/linux ima-snapshots-v1-devel-v1
head: b0bd002b6caa9d5d4f4d0db2a041b1fd91f33f8a
commit: b0bd002b6caa9d5d4f4d0db2a041b1fd91f33f8a [1/1] ima: Add support for measurement list snapshots
config: i386-randconfig-141-20251116 (https://download.01.org/0day-ci/archive/20251117/202511170428.8scOuqUb-lkp@intel.com/config)
compiler: gcc-13 (Debian 13.3.0-16) 13.3.0
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>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202511170428.8scOuqUb-lkp@intel.com/
smatch warnings:
security/integrity/ima/ima_fs.c:321 ima_measurements_snap_write() warn: maybe return -EFAULT instead of the bytes remaining?
vim +321 security/integrity/ima/ima_fs.c
b0bd002b6caa9d Roberto Sassu 2025-11-13 309 static ssize_t ima_measurements_snap_write(struct file *file,
b0bd002b6caa9d Roberto Sassu 2025-11-13 310 const char __user *buf,
b0bd002b6caa9d Roberto Sassu 2025-11-13 311 size_t datalen, loff_t *ppos)
b0bd002b6caa9d Roberto Sassu 2025-11-13 312 {
b0bd002b6caa9d Roberto Sassu 2025-11-13 313 unsigned char req[SNAPSHOT_REQ_LENGTH];
b0bd002b6caa9d Roberto Sassu 2025-11-13 314 int ret;
b0bd002b6caa9d Roberto Sassu 2025-11-13 315
b0bd002b6caa9d Roberto Sassu 2025-11-13 316 if (*ppos > 0 || datalen != SNAPSHOT_REQ_LENGTH)
b0bd002b6caa9d Roberto Sassu 2025-11-13 317 return -EINVAL;
b0bd002b6caa9d Roberto Sassu 2025-11-13 318
b0bd002b6caa9d Roberto Sassu 2025-11-13 319 ret = copy_from_user(req, buf, datalen);
b0bd002b6caa9d Roberto Sassu 2025-11-13 320 if (ret < 0)
b0bd002b6caa9d Roberto Sassu 2025-11-13 @321 return ret;
Yep. This should be:
if (copy_from_user(req, buf, datalen))
return -EFAULT;
b0bd002b6caa9d Roberto Sassu 2025-11-13 322
b0bd002b6caa9d Roberto Sassu 2025-11-13 323 if (req[1] != '\n')
b0bd002b6caa9d Roberto Sassu 2025-11-13 324 return -EINVAL;
b0bd002b6caa9d Roberto Sassu 2025-11-13 325
b0bd002b6caa9d Roberto Sassu 2025-11-13 326 switch (req[0]) {
b0bd002b6caa9d Roberto Sassu 2025-11-13 327 case SNAPSHOT_REQ_MAKE:
b0bd002b6caa9d Roberto Sassu 2025-11-13 328 ret = ima_queue_make_snapshot();
b0bd002b6caa9d Roberto Sassu 2025-11-13 329 break;
b0bd002b6caa9d Roberto Sassu 2025-11-13 330 case SNAPSHOT_REQ_DEL:
b0bd002b6caa9d Roberto Sassu 2025-11-13 331 ret = ima_queue_delete_snapshot();
b0bd002b6caa9d Roberto Sassu 2025-11-13 332 break;
b0bd002b6caa9d Roberto Sassu 2025-11-13 333 default:
b0bd002b6caa9d Roberto Sassu 2025-11-13 334 ret = -EINVAL;
b0bd002b6caa9d Roberto Sassu 2025-11-13 335 break;
b0bd002b6caa9d Roberto Sassu 2025-11-13 336 }
b0bd002b6caa9d Roberto Sassu 2025-11-13 337
b0bd002b6caa9d Roberto Sassu 2025-11-13 338 if (ret < 0)
b0bd002b6caa9d Roberto Sassu 2025-11-13 339 return ret;
b0bd002b6caa9d Roberto Sassu 2025-11-13 340
b0bd002b6caa9d Roberto Sassu 2025-11-13 341 return datalen;
b0bd002b6caa9d Roberto Sassu 2025-11-13 342 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [robertosassu:ima-snapshots-v1-devel-v1 1/1] security/integrity/ima/ima_fs.c:321 ima_measurements_snap_write() warn: maybe return -EFAULT instead of the bytes remaining?
2025-11-19 11:46 ` Dan Carpenter
(?)
@ 2025-11-19 11:49 ` Roberto Sassu
-1 siblings, 0 replies; 3+ messages in thread
From: Roberto Sassu @ 2025-11-19 11:49 UTC (permalink / raw)
To: Dan Carpenter, oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev
> From: Dan Carpenter <dan.carpenter@linaro.org>
> Sent: Wednesday, November 19, 2025 12:47 PM
> tree: https://github.com/robertosassu/linux ima-snapshots-v1-devel-v1
> head: b0bd002b6caa9d5d4f4d0db2a041b1fd91f33f8a
> commit: b0bd002b6caa9d5d4f4d0db2a041b1fd91f33f8a [1/1] ima: Add
> support for measurement list snapshots
> config: i386-randconfig-141-20251116 (https://download.01.org/0day-
> ci/archive/20251117/202511170428.8scOuqUb-lkp@intel.com/config)
> compiler: gcc-13 (Debian 13.3.0-16) 13.3.0
>
> 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>
> | Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> | Closes: https://lore.kernel.org/r/202511170428.8scOuqUb-lkp@intel.com/
>
> smatch warnings:
> security/integrity/ima/ima_fs.c:321 ima_measurements_snap_write() warn:
> maybe return -EFAULT instead of the bytes remaining?
>
> vim +321 security/integrity/ima/ima_fs.c
>
> b0bd002b6caa9d Roberto Sassu 2025-11-13 309 static ssize_t
> ima_measurements_snap_write(struct file *file,
> b0bd002b6caa9d Roberto Sassu 2025-11-13 310
> const char __user *buf,
> b0bd002b6caa9d Roberto Sassu 2025-11-13 311
> size_t datalen, loff_t *ppos)
> b0bd002b6caa9d Roberto Sassu 2025-11-13 312 {
> b0bd002b6caa9d Roberto Sassu 2025-11-13 313 unsigned char
> req[SNAPSHOT_REQ_LENGTH];
> b0bd002b6caa9d Roberto Sassu 2025-11-13 314 int ret;
> b0bd002b6caa9d Roberto Sassu 2025-11-13 315
> b0bd002b6caa9d Roberto Sassu 2025-11-13 316 if (*ppos > 0 ||
> datalen != SNAPSHOT_REQ_LENGTH)
> b0bd002b6caa9d Roberto Sassu 2025-11-13 317 return -
> EINVAL;
> b0bd002b6caa9d Roberto Sassu 2025-11-13 318
> b0bd002b6caa9d Roberto Sassu 2025-11-13 319 ret =
> copy_from_user(req, buf, datalen);
> b0bd002b6caa9d Roberto Sassu 2025-11-13 320 if (ret < 0)
> b0bd002b6caa9d Roberto Sassu 2025-11-13 @321 return ret;
>
> Yep. This should be:
>
> if (copy_from_user(req, buf, datalen))
> return -EFAULT;
Ok, thanks!
Roberto
> b0bd002b6caa9d Roberto Sassu 2025-11-13 322
> b0bd002b6caa9d Roberto Sassu 2025-11-13 323 if (req[1] != '\n')
> b0bd002b6caa9d Roberto Sassu 2025-11-13 324 return -
> EINVAL;
> b0bd002b6caa9d Roberto Sassu 2025-11-13 325
> b0bd002b6caa9d Roberto Sassu 2025-11-13 326 switch (req[0]) {
> b0bd002b6caa9d Roberto Sassu 2025-11-13 327 case
> SNAPSHOT_REQ_MAKE:
> b0bd002b6caa9d Roberto Sassu 2025-11-13 328 ret =
> ima_queue_make_snapshot();
> b0bd002b6caa9d Roberto Sassu 2025-11-13 329 break;
> b0bd002b6caa9d Roberto Sassu 2025-11-13 330 case
> SNAPSHOT_REQ_DEL:
> b0bd002b6caa9d Roberto Sassu 2025-11-13 331 ret =
> ima_queue_delete_snapshot();
> b0bd002b6caa9d Roberto Sassu 2025-11-13 332 break;
> b0bd002b6caa9d Roberto Sassu 2025-11-13 333 default:
> b0bd002b6caa9d Roberto Sassu 2025-11-13 334 ret = -EINVAL;
> b0bd002b6caa9d Roberto Sassu 2025-11-13 335 break;
> b0bd002b6caa9d Roberto Sassu 2025-11-13 336 }
> b0bd002b6caa9d Roberto Sassu 2025-11-13 337
> b0bd002b6caa9d Roberto Sassu 2025-11-13 338 if (ret < 0)
> b0bd002b6caa9d Roberto Sassu 2025-11-13 339 return ret;
> b0bd002b6caa9d Roberto Sassu 2025-11-13 340
> b0bd002b6caa9d Roberto Sassu 2025-11-13 341 return datalen;
> b0bd002b6caa9d Roberto Sassu 2025-11-13 342 }
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-11-19 11:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-16 21:05 [robertosassu:ima-snapshots-v1-devel-v1 1/1] security/integrity/ima/ima_fs.c:321 ima_measurements_snap_write() warn: maybe return -EFAULT instead of the bytes remaining? kernel test robot
2025-11-19 11:46 ` Dan Carpenter
2025-11-19 11:49 ` Roberto Sassu
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.