ecryptfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* re: eCryptfs: Use skcipher and shash
@ 2016-03-16  7:41 Dan Carpenter
  2016-03-16  9:06 ` Herbert Xu
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2016-03-16  7:41 UTC (permalink / raw)
  To: herbert; +Cc: ecryptfs

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

^ permalink raw reply	[flat|nested] 3+ messages in thread
* re: eCryptfs: Use skcipher and shash
@ 2016-03-15 20:28 Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2016-03-15 20:28 UTC (permalink / raw)
  To: herbert; +Cc: ecryptfs

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-03-16  9:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-16  7:41 eCryptfs: Use skcipher and shash Dan Carpenter
2016-03-16  9:06 ` Herbert Xu
  -- strict thread matches above, loose matches on Subject: below --
2016-03-15 20:28 Dan Carpenter

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).