All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: sargun@sargun.me
Cc: bpf@vger.kernel.org, Kees Cook <keescook@google.com>
Subject: [bug report] seccomp: Add find_notification helper
Date: Thu, 18 Jun 2020 17:27:14 +0300	[thread overview]
Message-ID: <20200618142714.GA202183@mwanda> (raw)

[ Kees, why am I getting tons and tons of these warnings?  Are we not
  going to initialize things manually any more? ]

Hello Sargun Dhillon,

The patch 186f03857c48: "seccomp: Add find_notification helper" from
Jun 1, 2020, leads to the following static checker warning:

	kernel/seccomp.c:1124 seccomp_notify_recv()
	error: uninitialized symbol 'knotif'.

kernel/seccomp.c
  1091  static long seccomp_notify_recv(struct seccomp_filter *filter,
  1092                                  void __user *buf)
  1093  {
  1094          struct seccomp_knotif *knotif, *cur;
                                       ^^^^^^
This used to be initialized to NULL here.

  1095          struct seccomp_notif unotif;
  1096          ssize_t ret;
  1097  
  1098          /* Verify that we're not given garbage to keep struct extensible. */
  1099          ret = check_zeroed_user(buf, sizeof(unotif));
  1100          if (ret < 0)
  1101                  return ret;
  1102          if (!ret)
  1103                  return -EINVAL;
  1104  
  1105          memset(&unotif, 0, sizeof(unotif));
  1106  
  1107          ret = down_interruptible(&filter->notif->request);
  1108          if (ret < 0)
  1109                  return ret;
  1110  
  1111          mutex_lock(&filter->notify_lock);
  1112          list_for_each_entry(cur, &filter->notif->notifications, list) {
  1113                  if (cur->state == SECCOMP_NOTIFY_INIT) {
  1114                          knotif = cur;
                                ^^^^^^^^^^^^

  1115                          break;
  1116                  }
  1117          }
  1118  
  1119          /*
  1120           * If we didn't find a notification, it could be that the task was
  1121           * interrupted by a fatal signal between the time we were woken and
  1122           * when we were able to acquire the rw lock.
  1123           */
  1124          if (!knotif) {
                     ^^^^^^
But now it's uninitialized.

  1125                  ret = -ENOENT;
  1126                  goto out;
  1127          }
  1128  
  1129          unotif.id = knotif->id;

regards,
dan carpenter

             reply	other threads:[~2020-06-18 14:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-18 14:27 Dan Carpenter [this message]
2020-06-18 21:01 ` [bug report] seccomp: Add find_notification helper Kees Cook
2020-06-19  7:37   ` Dan Carpenter

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=20200618142714.GA202183@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=bpf@vger.kernel.org \
    --cc=keescook@google.com \
    --cc=sargun@sargun.me \
    /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.