]> git.baikalelectronics.ru Git - kernel.git/commit
drm/nouveau/mmu: use struct_size() helper
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Fri, 24 May 2019 17:15:36 +0000 (12:15 -0500)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 23 Aug 2019 02:55:31 +0000 (12:55 +1000)
commit3f3b27238c10ab1a9a2ea755cd6fa9ce5e80b434
treecc08a7beb52de51319b80178008938cf6e1885c0
parent5edd05d5ffb55f5e98a4c36d1f6ffc9ad5182bb6
drm/nouveau/mmu: use struct_size() helper

Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes, in particular in the
context in which this code is being used.

So, replace the following form:

sizeof(*kind) + sizeof(*kind->data) * mmu->kind_nr;

with:

struct_size(kind, data, mmu->kind_nr)

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvif/mmu.c