History log of /linux-master/drivers/staging/vme_user/vme_fake.c
Revision Date Author Comments
# cf4381ee 19-Oct-2023 Calvince Otieno <calvncce@gmail.com>

staging: vme_user: replace strcpy with strscpy

Checkpatch suggests using strscpy() instead of strcpy().

The advantages of strscpy() are that it always adds a NUL terminator
and prevents read/write overflows if the source string is not properly
terminated.

strcpy() lacks built-in bounds checking for the destination buffer,
making it susceptible to buffer overflows. These overflows can lead
to various unpredictable behaviors.

In this specific context, both strscpy and strcpy performs the same
operation without any functional difference.

The reason for this equivalence is that the driver_name string "vme_fake"
is shorter than the size of the fake_bridge->name array which is defined
as 16 characters (struct vme_bridge {char name[VMENAMSIZ];...}). Thus,
there is no risk of buffer overflow in either case. VMENAMSIZ variable
holds a constant value of 16 (#define VMENAMSIZ 16)

The null-terminated "vme_fake" string
(static const char driver_name[] = "vme_fake";) can be safely copied into
fake_bridge->name using either strscpy or strcpy.

While using strscpy() does not address any bugs, it is considered a better
practice and aligns with checkpatch recommendations.

Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Calvince Otieno <calvncce@gmail.com>
Link: https://lore.kernel.org/r/ZTDS2H48JBUTiwZi@lab-ubuntu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# dbe2fdaf 03-Sep-2023 Jonathan Bergh <bergh.jonathan@gmail.com>

staging: vme_user: Remove unused (commented) code causing unnecessary checkpatch warning

Removed unused/commented code from vme_fake.c which was causing spurious
checkpatch warnings.

Signed-off-by: Jonathan Bergh <bergh.jonathan@gmail.com>
Link: https://lore.kernel.org/r/20230903150623.571984-1-bergh.jonathan@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 3abba9a4 27-Aug-2023 Alexon Oliveira <alexondunkan@gmail.com>

staging: vme_user: fix check unnecessary space after a cast in vme_fake.c

Fixed all CHECK: No space is necessary after a cast
as reported by checkpatch to adhere to the Linux kernel
coding-style guidelines.

Signed-off-by: Alexon Oliveira <alexondunkan@gmail.com>
Link: https://lore.kernel.org/r/603976b29ad4d9a0e4cbd8452ff674ec70a227a8.1693164540.git.alexondunkan@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 571fa9b5 27-Aug-2023 Alexon Oliveira <alexondunkan@gmail.com>

staging: vme_user: fix check unnecessary blank lines in vme_fake.c

Fixed all CHECK: Blank lines aren't necessary before a close brace '}'
as reported by checkpatch to adhere to the Linux kernel
coding-style guidelines.

Signed-off-by: Alexon Oliveira <alexondunkan@gmail.com>
Link: https://lore.kernel.org/r/dde6f13f92a7cb17e01aceaeabe790656078326e.1693164540.git.alexondunkan@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f6a90f10 27-Aug-2023 Alexon Oliveira <alexondunkan@gmail.com>

staging: vme_user: fix check lines not ending with '(' in vme_fake.c

Fixed all CHECK: Lines should not end with a '('
as reported by checkpatch to adhere to the Linux kernel
coding-style guidelines.

Signed-off-by: Alexon Oliveira <alexondunkan@gmail.com>
Link: https://lore.kernel.org/r/9f3e2facdc4d5e612dc00830c2da0fb19c20f2c5.1693164540.git.alexondunkan@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# b25f7cb3 27-Aug-2023 Alexon Oliveira <alexondunkan@gmail.com>

staging: vme_user: fix check alignment of open parenthesis in vme_fake.c

Fixed all CHECK: Alignment should match open parenthesis
as reported by checkpatch to adhere to the Linux kernel
coding-style guidelines.

Signed-off-by: Alexon Oliveira <alexondunkan@gmail.com>
Link: https://lore.kernel.org/r/639fc19f5c5bce6557a813728b28c299c5134ecf.1693164540.git.alexondunkan@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# af5a5587 24-Feb-2023 Rohit Chavan <roheetchavan@gmail.com>

staging: vme: remove blank line after return statement

This patch resolves a checkpatch issue by removing blank line,
after return statement at end of the function.

Signed-off-by: Rohit Chavan <roheetchavan@gmail.com>
Link: https://lore.kernel.org/r/20230224123401.1365-1-roheetchavan@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 37aa6b98 05-Dec-2022 Chen Zhongjin <chenzhongjin@huawei.com>

vme: Use root_device_register() not underlined version

root_device_register and __root_device_register have exactly same
effect. Use the not underlined version to keep usage consistency.

Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com>
Link: https://lore.kernel.org/r/20221206015033.125827-1-chenzhongjin@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7bef797d 05-Dec-2022 Chen Zhongjin <chenzhongjin@huawei.com>

vme: Fix error not catched in fake_init()

In fake_init(), __root_device_register() is possible to fail but it's
ignored, which can cause unregistering vme_root fail when exit.

general protection fault,
probably for non-canonical address 0xdffffc000000008c
KASAN: null-ptr-deref in range [0x0000000000000460-0x0000000000000467]
RIP: 0010:root_device_unregister+0x26/0x60
Call Trace:
<TASK>
__x64_sys_delete_module+0x34f/0x540
do_syscall_64+0x38/0x90
entry_SYSCALL_64_after_hwframe+0x63/0xcd

Return error when __root_device_register() fails.

Fixes: 658bcdae9c67 ("vme: Adding Fake VME driver")
Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com>
Link: https://lore.kernel.org/r/20221205084805.147436-1-chenzhongjin@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# bf44039f 04-Dec-2022 Matt Jan <zoo868e@gmail.com>

staging: vme_user: remove multiple blank lines

Remove multiple unnecessary blank lines in accordance with the Linux
kernel coding-style regulations. The issues were reported by the
checkpatch script.

Signed-off-by: Matt Jan <zoo868e@gmail.com>
Link: https://lore.kernel.org/r/20221204101916.GA51992@zoo868e
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 35ba63b8 06-Jun-2022 Arnd Bergmann <arnd@arndb.de>

vme: move back to staging

The VME subsystem graduated from staging into a top-level subsystem in
2012, with commit db3b9e990e75 ("Staging: VME: move VME drivers out of
staging") stating:

The VME device drivers have not moved out yet due to some API
questions they are still working through, that should happen soon,
hopefully.

However, this never happened: maintenance of drivers/vme effectively
stopped in 2017, with all subsequent changes being treewide cleanups.
No hardware driver remains in staging, only the limited user-level
access, and I just removed one of the two bridge drivers and the only
remaining board.

drivers/staging/vme/devices/ was recently moved to
drivers/staging/vme_user/, but as the vme_user driver is the only one
remaining for this subsystem, it is easier to just move the remaining
three source files into this directory rather than keeping the original
hierarchy.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20220606084109.4108188-3-arnd@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>