]> git.baikalelectronics.ru Git - kernel.git/commit
drm/nouveau/secboot: remove VLA usage
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Tue, 13 Mar 2018 16:24:11 +0000 (11:24 -0500)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 18 May 2018 05:01:20 +0000 (15:01 +1000)
commit808deb099db46c4c7d7ead2b02680954a1b39509
treee1d40ed5f61beb8beef231e7695e0edd939a3f71
parenta35dd6c54e74245786a7f73d32e3b75224a8e838
drm/nouveau/secboot: remove VLA usage

In preparation to enabling -Wvla, remove VLA. In this particular
case directly use macro NVKM_MSGQUEUE_CMDLINE_SIZE instead of local
variable cmdline_size. Also, remove cmdline_size as it is not
actually useful anymore.

The use of stack Variable Length Arrays needs to be avoided, as they
can be a vector for stack exhaustion, which can be both a runtime bug
or a security flaw. Also, in general, as code evolves it is easy to
lose track of how big a VLA can get. Thus, we can end up having runtime
failures that are hard to debug.

Also, fixed as part of the directive to remove all VLAs from
the kernel: https://lkml.org/lkml/2018/3/7/621

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/ls_ucode_msgqueue.c