public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Christian Brauner <brauner@kernel.org>
Cc: kernel-janitors@vger.kernel.org
Subject: [bug report] ipc: preserve original file opening pattern
Date: Fri, 28 Nov 2025 10:10:28 +0300	[thread overview]
Message-ID: <aSlK5JTolU2UsHLp@stanley.mountain> (raw)

Hello Christian Brauner,

Commit ea2f85c54e81 ("ipc: preserve original file opening pattern")
from Nov 26, 2025 (linux-next), leads to the following Smatch static
checker warning:

	ipc/mqueue.c:907 mqueue_file_open()
	warn: passing positive error code '1' to 'ERR_PTR'

ipc/mqueue.c
    889 static struct file *mqueue_file_open(struct filename *name,
    890                                      struct vfsmount *mnt, int oflag, bool ro,
    891                                      umode_t mode, struct mq_attr *attr)
    892 {
    893         struct path path __free(path_put) = {};
    894         struct dentry *dentry;
    895         struct file *file;
    896         int ret;
    897 
    898         dentry = start_creating_noperm(mnt->mnt_root, &QSTR(name->name));
    899         if (IS_ERR(dentry))
    900                 return ERR_CAST(dentry);
    901 
    902         path.dentry = dentry;
    903         path.mnt = mntget(mnt);
    904 
    905         ret = prepare_open(path.dentry, oflag, ro, mode, name, attr);
    906         if (ret)
--> 907                 return ERR_PTR(ret);

prepare_open() can return 1 if the ro (read only) variable is true and
Smatch complains if we pass a positive to ERR_PTR().

    908 
    909         file = dentry_open(&path, oflag, current_cred());
    910         end_creating(dentry);
    911         return file;
    912 }

regards,
dan carpenter

                 reply	other threads:[~2025-11-28  7:10 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=aSlK5JTolU2UsHLp@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=brauner@kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox