ecryptfs.vger.kernel.org archive mirror
 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: Tue, 15 Mar 2016 23:28:06 +0300	[thread overview]
Message-ID: <20160315202806.GA4687@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:867 ecryptfs_write_tag_70_packet()
	error: potential null dereference 's'.  (kzalloc returns null)

fs/ecryptfs/keystore.c
   624  int
   625  ecryptfs_write_tag_70_packet(char *dest, size_t *remaining_bytes,
   626                               size_t *packet_size,
   627                               struct ecryptfs_mount_crypt_stat *mount_crypt_stat,
   628                               char *filename, size_t filename_size)
   629  {
   630          struct ecryptfs_write_tag_70_packet_silly_stack *s;
   631          struct key *auth_tok_key = NULL;
   632          int rc = 0;
   633  
   634          s = kzalloc(sizeof(*s), GFP_KERNEL);
   635          if (!s) {
   636                  printk(KERN_ERR "%s: Out of memory whilst trying to kmalloc "
   637                         "[%zd] bytes of kernel memory\n", __func__, sizeof(*s));
   638                  rc = -ENOMEM;
   639                  goto out;
                        ^^^^^^^^
   640          }

[ snip ]

   862  out:
   863          if (auth_tok_key) {
   864                  up_write(&(auth_tok_key->sem));
   865                  key_put(auth_tok_key);
   866          }
   867          skcipher_request_free(s->skcipher_req);
                                      ^^^^^^^^^^^^^^^
   868          kzfree(s->hash_desc);
                       ^^^^^^^^^^^^
   869          kfree(s);
   870          return rc;
   871  }

regards,
dan carpenter

             reply	other threads:[~2016-03-15 20:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-15 20:28 Dan Carpenter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-03-16  7:41 eCryptfs: Use skcipher and shash Dan Carpenter
2016-03-16  9:06 ` Herbert Xu

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=20160315202806.GA4687@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;
as well as URLs for NNTP newsgroup(s).