From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [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?
Date: Mon, 17 Nov 2025 05:05:36 +0800 [thread overview]
Message-ID: <202511170428.8scOuqUb-lkp@intel.com> (raw)
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
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@linaro.org>
To: oe-kbuild@lists.linux.dev, Roberto Sassu <roberto.sassu@huawei.com>
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev
Subject: [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?
Date: Wed, 19 Nov 2025 14:46:59 +0300 [thread overview]
Message-ID: <202511170428.8scOuqUb-lkp@intel.com> (raw)
Message-ID: <20251119114659.2uPizMFlaMBDqo4Qe1b-rWZPL0RWWFtFfyptHvC75JE@z> (raw)
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
next reply other threads:[~2025-11-16 21:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-16 21:05 kernel test robot [this message]
2025-11-19 11:46 ` [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? Dan Carpenter
2025-11-19 11:49 ` Roberto Sassu
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=202511170428.8scOuqUb-lkp@intel.com \
--to=lkp@intel.com \
--cc=error27@gmail.com \
--cc=oe-kbuild@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.