public inbox for ecryptfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: herbert@gondor.apana.org.au
Cc: ecryptfs@vger.kernel.org
Subject: re: eCryptfs: Use skcipher and shash
Date: Wed, 16 Mar 2016 10:41:41 +0300	[thread overview]
Message-ID: <20160316074141.GB12860@mwanda> (raw)

Hello Herbert Xu,

The patch 3095e8e366b4: "eCryptfs: Use skcipher and shash" from Jan
25, 2016, leads to the following static checker warning:

	fs/ecryptfs/keystore.c:1117 ecryptfs_parse_tag_70_packet()
	error: potential null dereference 's'.  (kzalloc returns null)

fs/ecryptfs/keystore.c
   908  int
   909  ecryptfs_parse_tag_70_packet(char **filename, size_t *filename_size,
   910                               size_t *packet_size,
   911                               struct ecryptfs_mount_crypt_stat *mount_crypt_stat,
   912                               char *data, size_t max_packet_size)
   913  {
   914          struct ecryptfs_parse_tag_70_packet_silly_stack *s;
   915          struct key *auth_tok_key = NULL;
   916          int rc = 0;
   917  
   918          (*packet_size) = 0;
   919          (*filename_size) = 0;
   920          (*filename) = NULL;
   921          s = kzalloc(sizeof(*s), GFP_KERNEL);
   922          if (!s) {
                    ^^^
   923                  printk(KERN_ERR "%s: Out of memory whilst trying to kmalloc "
   924                         "[%zd] bytes of kernel memory\n", __func__, sizeof(*s));
   925                  rc = -ENOMEM;
   926                  goto out;
                        ^^^^^^^^
   927          }

[ snip ]

  1107  out:
  1108          if (rc) {
  1109                  (*packet_size) = 0;
  1110                  (*filename_size) = 0;
  1111                  (*filename) = NULL;
  1112          }
  1113          if (auth_tok_key) {
  1114                  up_write(&(auth_tok_key->sem));
  1115                  key_put(auth_tok_key);
  1116          }
  1117          skcipher_request_free(s->skcipher_req);
                                      ^^^^^^^^^^^^^^^
  1118          kfree(s);
  1119          return rc;
  1120  }

regards,
dan carpenter

             reply	other threads:[~2016-03-16  7:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-16  7:41 Dan Carpenter [this message]
2016-03-16  9:06 ` eCryptfs: Use skcipher and shash Herbert Xu
  -- strict thread matches above, loose matches on Subject: below --
2016-03-15 20:28 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=20160316074141.GB12860@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=ecryptfs@vger.kernel.org \
    --cc=herbert@gondor.apana.org.au \
    /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