char: aml-gpiomem: Use allocated pointer for class registration 56/251856/1
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Wed, 20 Jan 2021 02:00:11 +0000 (11:00 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Wed, 20 Jan 2021 02:55:24 +0000 (11:55 +0900)
commit5f1acde8c82eb3099af328a6e4f5155051ed809d
treeefd2642c484dd8658d028ad43e215f5b635dbfea
parent5dd3ffecd46fe44a93ee072c649ea10c058f7fb8
char: aml-gpiomem: Use allocated pointer for class registration

The class name for class_create() requires memory pointer not freed
until the class is destroy, but local array is used, so it causes
memory bad access. Use allocated pointer for class registration.

This fixes below kasan warning:
   BUG: KASAN: out-of-bounds in strlcpy+0x48/0x88
   Read of size 11 at addr ffffffc00029f9c0 by task udevadm/2912
   ...
   [<ffffff900941ca9c>] check_memory_region+0x12c/0x1a0
   [<ffffff900941d0d4>] memcpy+0x34/0x68
   [<ffffff9009af8968>] strlcpy+0x48/0x88
   [<ffffff9009aeb74c>] kobject_uevent_env+0x55c/0x948
   [<ffffff9009aebb48>] kobject_uevent+0x10/0x18
   [<ffffff9009de5ca0>] uevent_store+0xf0/0xf8
   ...

Change-Id: I0e265a8b1b52e732de262a0058bd821419ca4fe8
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
drivers/char/aml-gpiomem.c