From: Roberto Sassu <roberto.sassu@huawei.com>
To: Dan Carpenter <dan.carpenter@linaro.org>,
"oe-kbuild@lists.linux.dev" <oe-kbuild@lists.linux.dev>
Cc: "lkp@intel.com" <lkp@intel.com>,
"oe-kbuild-all@lists.linux.dev" <oe-kbuild-all@lists.linux.dev>
Subject: 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?
Date: Wed, 19 Nov 2025 11:49:43 +0000 [thread overview]
Message-ID: <4a3433e45ab949af8d40356bb2fda857@huawei.com> (raw)
In-Reply-To: <202511170428.8scOuqUb-lkp@intel.com>
> 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
prev parent reply other threads:[~2025-11-19 11:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
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=4a3433e45ab949af8d40356bb2fda857@huawei.com \
--to=roberto.sassu@huawei.com \
--cc=dan.carpenter@linaro.org \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--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.