From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: [dhowells-fs:fscache-next 10/11] fs/cachefiles/interface.c:101 cachefiles_alloc_object() error: uninitialized symbol 'lookup_data'.
Date: Mon, 04 Nov 2019 09:56:53 +0300 [thread overview]
Message-ID: <20191104065653.GF21796@kadam> (raw)
[-- Attachment #1: Type: text/plain, Size: 7640 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git fscache-next
head: a378de860278da7a006db7135ce24cf56cd8b552
commit: 22691addb04f46468ead9648b7e95d213312c82f [10/11] cachefiles: Reduce cleanup in cachefiles_alloc_object()
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
fs/cachefiles/interface.c:101 cachefiles_alloc_object() error: uninitialized symbol 'lookup_data'.
# https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/commit/?id=22691addb04f46468ead9648b7e95d213312c82f
git remote add dhowells-fs https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git
git remote update dhowells-fs
git checkout 22691addb04f46468ead9648b7e95d213312c82f
vim +/lookup_data +101 fs/cachefiles/interface.c
9ae326a69004de David Howells 2009-04-03 26 static struct fscache_object *cachefiles_alloc_object(
9ae326a69004de David Howells 2009-04-03 27 struct fscache_cache *_cache,
9ae326a69004de David Howells 2009-04-03 28 struct fscache_cookie *cookie)
9ae326a69004de David Howells 2009-04-03 29 {
9ae326a69004de David Howells 2009-04-03 30 struct cachefiles_lookup_data *lookup_data;
This is only used for the sizeof().
9ae326a69004de David Howells 2009-04-03 31 struct cachefiles_object *object;
9ae326a69004de David Howells 2009-04-03 32 struct cachefiles_cache *cache;
9ae326a69004de David Howells 2009-04-03 33 struct cachefiles_xattr *auxdata;
9ae326a69004de David Howells 2009-04-03 34 unsigned keylen, auxlen;
402cb8dda949d9 David Howells 2018-04-04 35 void *buffer, *p;
9ae326a69004de David Howells 2009-04-03 36
9ae326a69004de David Howells 2009-04-03 37 cache = container_of(_cache, struct cachefiles_cache, cache);
9ae326a69004de David Howells 2009-04-03 38
9ae326a69004de David Howells 2009-04-03 39 _enter("{%s},%p,", cache->cache.identifier, cookie);
9ae326a69004de David Howells 2009-04-03 40
9ae326a69004de David Howells 2009-04-03 41 /* create a new object record and a temporary leaf image */
6feed675ec5813 David Howells 2019-10-31 42 object = kmem_cache_zalloc(cachefiles_object_jar, cachefiles_gfp);
9ae326a69004de David Howells 2009-04-03 43 if (!object)
22691addb04f46 David Howells 2019-10-31 44 goto nomem;
9ae326a69004de David Howells 2009-04-03 45
9ae326a69004de David Howells 2009-04-03 46 ASSERTCMP(object->backer, ==, NULL);
9ae326a69004de David Howells 2009-04-03 47
9ae326a69004de David Howells 2009-04-03 48 BUG_ON(test_bit(CACHEFILES_OBJECT_ACTIVE, &object->flags));
9ae326a69004de David Howells 2009-04-03 49 atomic_set(&object->usage, 1);
6feed675ec5813 David Howells 2019-10-31 50 spin_lock_init(&object->work_lock);
9ae326a69004de David Howells 2009-04-03 51
9ae326a69004de David Howells 2009-04-03 52 fscache_object_init(&object->fscache, cookie, &cache->cache);
9ae326a69004de David Howells 2009-04-03 53
9ae326a69004de David Howells 2009-04-03 54 object->type = cookie->def->type;
9ae326a69004de David Howells 2009-04-03 55
22691addb04f46 David Howells 2019-10-31 56 object->lookup_data = kzalloc(sizeof(*lookup_data), cachefiles_gfp);
^^^^^^^^^^^^^^
22691addb04f46 David Howells 2019-10-31 57 if (!object->lookup_data)
22691addb04f46 David Howells 2019-10-31 58 goto nomem_object;
22691addb04f46 David Howells 2019-10-31 59
9ae326a69004de David Howells 2009-04-03 60 /* get hold of the raw key
9ae326a69004de David Howells 2009-04-03 61 * - stick the length on the front and leave space on the back for the
9ae326a69004de David Howells 2009-04-03 62 * encoder
9ae326a69004de David Howells 2009-04-03 63 */
22691addb04f46 David Howells 2019-10-31 64 object->lookup_data->auxdata = kmalloc((2 + 512) + 3, cachefiles_gfp);
22691addb04f46 David Howells 2019-10-31 65 if (!object->lookup_data->auxdata)
22691addb04f46 David Howells 2019-10-31 66 goto nomem_object;
9ae326a69004de David Howells 2009-04-03 67
402cb8dda949d9 David Howells 2018-04-04 68 keylen = cookie->key_len;
402cb8dda949d9 David Howells 2018-04-04 69 if (keylen <= sizeof(cookie->inline_key))
402cb8dda949d9 David Howells 2018-04-04 70 p = cookie->inline_key;
402cb8dda949d9 David Howells 2018-04-04 71 else
402cb8dda949d9 David Howells 2018-04-04 72 p = cookie->key;
22691addb04f46 David Howells 2019-10-31 73
22691addb04f46 David Howells 2019-10-31 74 buffer = object->lookup_data->auxdata;
402cb8dda949d9 David Howells 2018-04-04 75 memcpy(buffer + 2, p, keylen);
9ae326a69004de David Howells 2009-04-03 76
9ae326a69004de David Howells 2009-04-03 77 *(uint16_t *)buffer = keylen;
9ae326a69004de David Howells 2009-04-03 78 ((char *)buffer)[keylen + 2] = 0;
9ae326a69004de David Howells 2009-04-03 79 ((char *)buffer)[keylen + 3] = 0;
9ae326a69004de David Howells 2009-04-03 80 ((char *)buffer)[keylen + 4] = 0;
9ae326a69004de David Howells 2009-04-03 81
9ae326a69004de David Howells 2009-04-03 82 /* turn the raw key into something that can work with as a filename */
22691addb04f46 David Howells 2019-10-31 83 object->lookup_data->key = cachefiles_cook_key(buffer, keylen + 2, object->type);
22691addb04f46 David Howells 2019-10-31 84 if (!object->lookup_data->key)
22691addb04f46 David Howells 2019-10-31 85 goto nomem_object;
9ae326a69004de David Howells 2009-04-03 86
9ae326a69004de David Howells 2009-04-03 87 /* get hold of the auxiliary data and prepend the object type */
22691addb04f46 David Howells 2019-10-31 88 auxdata = object->lookup_data->auxdata;
402cb8dda949d9 David Howells 2018-04-04 89 auxlen = cookie->aux_len;
402cb8dda949d9 David Howells 2018-04-04 90 if (auxlen) {
402cb8dda949d9 David Howells 2018-04-04 91 if (auxlen <= sizeof(cookie->inline_aux))
402cb8dda949d9 David Howells 2018-04-04 92 p = cookie->inline_aux;
402cb8dda949d9 David Howells 2018-04-04 93 else
402cb8dda949d9 David Howells 2018-04-04 94 p = cookie->aux;
402cb8dda949d9 David Howells 2018-04-04 95 memcpy(auxdata->data, p, auxlen);
9ae326a69004de David Howells 2009-04-03 96 }
9ae326a69004de David Howells 2009-04-03 97
9ae326a69004de David Howells 2009-04-03 98 auxdata->len = auxlen + 1;
402cb8dda949d9 David Howells 2018-04-04 99 auxdata->type = cookie->type;
9ae326a69004de David Howells 2009-04-03 100
9ae326a69004de David Howells 2009-04-03 @101 _leave(" = %p [%p]", &object->fscache, lookup_data);
^^^^^^^^^^^
9ae326a69004de David Howells 2009-04-03 102 return &object->fscache;
9ae326a69004de David Howells 2009-04-03 103
9ae326a69004de David Howells 2009-04-03 104 nomem_object:
22691addb04f46 David Howells 2019-10-31 105 cachefiles_put_object(&object->fscache, fscache_obj_put_alloc_fail);
22691addb04f46 David Howells 2019-10-31 106 nomem:
9ae326a69004de David Howells 2009-04-03 107 _leave(" = -ENOMEM");
9ae326a69004de David Howells 2009-04-03 108 return ERR_PTR(-ENOMEM);
9ae326a69004de David Howells 2009-04-03 109 }
9ae326a69004de David Howells 2009-04-03 110
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: [dhowells-fs:fscache-next 10/11] fs/cachefiles/interface.c:101 cachefiles_alloc_object() error: uninitialized symbol 'lookup_data'.
Date: Mon, 04 Nov 2019 09:56:53 +0300 [thread overview]
Message-ID: <20191104065653.GF21796@kadam> (raw)
[-- Attachment #1: Type: text/plain, Size: 7640 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git fscache-next
head: a378de860278da7a006db7135ce24cf56cd8b552
commit: 22691addb04f46468ead9648b7e95d213312c82f [10/11] cachefiles: Reduce cleanup in cachefiles_alloc_object()
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
fs/cachefiles/interface.c:101 cachefiles_alloc_object() error: uninitialized symbol 'lookup_data'.
# https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/commit/?id=22691addb04f46468ead9648b7e95d213312c82f
git remote add dhowells-fs https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git
git remote update dhowells-fs
git checkout 22691addb04f46468ead9648b7e95d213312c82f
vim +/lookup_data +101 fs/cachefiles/interface.c
9ae326a69004de David Howells 2009-04-03 26 static struct fscache_object *cachefiles_alloc_object(
9ae326a69004de David Howells 2009-04-03 27 struct fscache_cache *_cache,
9ae326a69004de David Howells 2009-04-03 28 struct fscache_cookie *cookie)
9ae326a69004de David Howells 2009-04-03 29 {
9ae326a69004de David Howells 2009-04-03 30 struct cachefiles_lookup_data *lookup_data;
This is only used for the sizeof().
9ae326a69004de David Howells 2009-04-03 31 struct cachefiles_object *object;
9ae326a69004de David Howells 2009-04-03 32 struct cachefiles_cache *cache;
9ae326a69004de David Howells 2009-04-03 33 struct cachefiles_xattr *auxdata;
9ae326a69004de David Howells 2009-04-03 34 unsigned keylen, auxlen;
402cb8dda949d9 David Howells 2018-04-04 35 void *buffer, *p;
9ae326a69004de David Howells 2009-04-03 36
9ae326a69004de David Howells 2009-04-03 37 cache = container_of(_cache, struct cachefiles_cache, cache);
9ae326a69004de David Howells 2009-04-03 38
9ae326a69004de David Howells 2009-04-03 39 _enter("{%s},%p,", cache->cache.identifier, cookie);
9ae326a69004de David Howells 2009-04-03 40
9ae326a69004de David Howells 2009-04-03 41 /* create a new object record and a temporary leaf image */
6feed675ec5813 David Howells 2019-10-31 42 object = kmem_cache_zalloc(cachefiles_object_jar, cachefiles_gfp);
9ae326a69004de David Howells 2009-04-03 43 if (!object)
22691addb04f46 David Howells 2019-10-31 44 goto nomem;
9ae326a69004de David Howells 2009-04-03 45
9ae326a69004de David Howells 2009-04-03 46 ASSERTCMP(object->backer, ==, NULL);
9ae326a69004de David Howells 2009-04-03 47
9ae326a69004de David Howells 2009-04-03 48 BUG_ON(test_bit(CACHEFILES_OBJECT_ACTIVE, &object->flags));
9ae326a69004de David Howells 2009-04-03 49 atomic_set(&object->usage, 1);
6feed675ec5813 David Howells 2019-10-31 50 spin_lock_init(&object->work_lock);
9ae326a69004de David Howells 2009-04-03 51
9ae326a69004de David Howells 2009-04-03 52 fscache_object_init(&object->fscache, cookie, &cache->cache);
9ae326a69004de David Howells 2009-04-03 53
9ae326a69004de David Howells 2009-04-03 54 object->type = cookie->def->type;
9ae326a69004de David Howells 2009-04-03 55
22691addb04f46 David Howells 2019-10-31 56 object->lookup_data = kzalloc(sizeof(*lookup_data), cachefiles_gfp);
^^^^^^^^^^^^^^
22691addb04f46 David Howells 2019-10-31 57 if (!object->lookup_data)
22691addb04f46 David Howells 2019-10-31 58 goto nomem_object;
22691addb04f46 David Howells 2019-10-31 59
9ae326a69004de David Howells 2009-04-03 60 /* get hold of the raw key
9ae326a69004de David Howells 2009-04-03 61 * - stick the length on the front and leave space on the back for the
9ae326a69004de David Howells 2009-04-03 62 * encoder
9ae326a69004de David Howells 2009-04-03 63 */
22691addb04f46 David Howells 2019-10-31 64 object->lookup_data->auxdata = kmalloc((2 + 512) + 3, cachefiles_gfp);
22691addb04f46 David Howells 2019-10-31 65 if (!object->lookup_data->auxdata)
22691addb04f46 David Howells 2019-10-31 66 goto nomem_object;
9ae326a69004de David Howells 2009-04-03 67
402cb8dda949d9 David Howells 2018-04-04 68 keylen = cookie->key_len;
402cb8dda949d9 David Howells 2018-04-04 69 if (keylen <= sizeof(cookie->inline_key))
402cb8dda949d9 David Howells 2018-04-04 70 p = cookie->inline_key;
402cb8dda949d9 David Howells 2018-04-04 71 else
402cb8dda949d9 David Howells 2018-04-04 72 p = cookie->key;
22691addb04f46 David Howells 2019-10-31 73
22691addb04f46 David Howells 2019-10-31 74 buffer = object->lookup_data->auxdata;
402cb8dda949d9 David Howells 2018-04-04 75 memcpy(buffer + 2, p, keylen);
9ae326a69004de David Howells 2009-04-03 76
9ae326a69004de David Howells 2009-04-03 77 *(uint16_t *)buffer = keylen;
9ae326a69004de David Howells 2009-04-03 78 ((char *)buffer)[keylen + 2] = 0;
9ae326a69004de David Howells 2009-04-03 79 ((char *)buffer)[keylen + 3] = 0;
9ae326a69004de David Howells 2009-04-03 80 ((char *)buffer)[keylen + 4] = 0;
9ae326a69004de David Howells 2009-04-03 81
9ae326a69004de David Howells 2009-04-03 82 /* turn the raw key into something that can work with as a filename */
22691addb04f46 David Howells 2019-10-31 83 object->lookup_data->key = cachefiles_cook_key(buffer, keylen + 2, object->type);
22691addb04f46 David Howells 2019-10-31 84 if (!object->lookup_data->key)
22691addb04f46 David Howells 2019-10-31 85 goto nomem_object;
9ae326a69004de David Howells 2009-04-03 86
9ae326a69004de David Howells 2009-04-03 87 /* get hold of the auxiliary data and prepend the object type */
22691addb04f46 David Howells 2019-10-31 88 auxdata = object->lookup_data->auxdata;
402cb8dda949d9 David Howells 2018-04-04 89 auxlen = cookie->aux_len;
402cb8dda949d9 David Howells 2018-04-04 90 if (auxlen) {
402cb8dda949d9 David Howells 2018-04-04 91 if (auxlen <= sizeof(cookie->inline_aux))
402cb8dda949d9 David Howells 2018-04-04 92 p = cookie->inline_aux;
402cb8dda949d9 David Howells 2018-04-04 93 else
402cb8dda949d9 David Howells 2018-04-04 94 p = cookie->aux;
402cb8dda949d9 David Howells 2018-04-04 95 memcpy(auxdata->data, p, auxlen);
9ae326a69004de David Howells 2009-04-03 96 }
9ae326a69004de David Howells 2009-04-03 97
9ae326a69004de David Howells 2009-04-03 98 auxdata->len = auxlen + 1;
402cb8dda949d9 David Howells 2018-04-04 99 auxdata->type = cookie->type;
9ae326a69004de David Howells 2009-04-03 100
9ae326a69004de David Howells 2009-04-03 @101 _leave(" = %p [%p]", &object->fscache, lookup_data);
^^^^^^^^^^^
9ae326a69004de David Howells 2009-04-03 102 return &object->fscache;
9ae326a69004de David Howells 2009-04-03 103
9ae326a69004de David Howells 2009-04-03 104 nomem_object:
22691addb04f46 David Howells 2019-10-31 105 cachefiles_put_object(&object->fscache, fscache_obj_put_alloc_fail);
22691addb04f46 David Howells 2019-10-31 106 nomem:
9ae326a69004de David Howells 2009-04-03 107 _leave(" = -ENOMEM");
9ae326a69004de David Howells 2009-04-03 108 return ERR_PTR(-ENOMEM);
9ae326a69004de David Howells 2009-04-03 109 }
9ae326a69004de David Howells 2009-04-03 110
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
next reply other threads:[~2019-11-04 6:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-04 6:56 Dan Carpenter [this message]
2019-11-04 6:56 ` [dhowells-fs:fscache-next 10/11] fs/cachefiles/interface.c:101 cachefiles_alloc_object() error: uninitialized symbol 'lookup_data' 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=20191104065653.GF21796@kadam \
--to=dan.carpenter@oracle.com \
--cc=kbuild@lists.01.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 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.