]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
s390/zcrypt: fix using the correct variable for sizeof()
authorJakob Koschel <jakobkoschel@gmail.com>
Sat, 19 Mar 2022 20:35:28 +0000 (21:35 +0100)
committerVasily Gorbik <gor@linux.ibm.com>
Sun, 27 Mar 2022 20:18:39 +0000 (22:18 +0200)
While the original code is valid, it is not the obvious choice for the
sizeof() call and in preparation to limit the scope of the list iterator
variable the sizeof should be changed to the size of the variable
being allocated.

Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com>
Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
drivers/s390/crypto/zcrypt_card.c

index 3e259befd30addb51154b53c89da64200dcbc757..fcbd537530e8469bdbf006145f03fe10d54fff64 100644 (file)
@@ -90,7 +90,7 @@ static ssize_t online_store(struct device *dev,
        list_for_each_entry(zq, &zc->zqueues, list)
                maxzqs++;
        if (maxzqs > 0)
-               zq_uelist = kcalloc(maxzqs + 1, sizeof(zq), GFP_ATOMIC);
+               zq_uelist = kcalloc(maxzqs + 1, sizeof(*zq_uelist), GFP_ATOMIC);
        list_for_each_entry(zq, &zc->zqueues, list)
                if (zcrypt_queue_force_online(zq, online))
                        if (zq_uelist) {