Skip to content

Commit 3280c93

Browse files
lorelei-sakaiMikulas Patocka
authored andcommitted
dm vdo: use a short static string for thread name prefix
Also remove MODULE_NAME and a BUG_ON check, both unneeded. This fixes a warning about string truncation in snprintf that will never happen in practice: drivers/md/dm-vdo/vdo.c: In function ‘vdo_make’: drivers/md/dm-vdo/vdo.c:564:5: error: ‘%s’ directive output may be truncated writing up to 55 bytes into a region of size 16 [-Werror=format-truncation=] "%s%u", MODULE_NAME, instance); ^~ drivers/md/dm-vdo/vdo.c:563:2: note: ‘snprintf’ output between 2 and 66 bytes into a destination of size 16 snprintf(vdo->thread_name_prefix, sizeof(vdo->thread_name_prefix), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "%s%u", MODULE_NAME, instance); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Reported-by: John Garry <john.g.garry@oracle.com> Reviewed-by: John Garry <john.g.garry@oracle.com> Signed-off-by: Matthew Sakai <msakai@redhat.com> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
1 parent 8892606 commit 3280c93

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

drivers/md/dm-vdo/vdo.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@
3131

3232
#include <linux/completion.h>
3333
#include <linux/device-mapper.h>
34-
#include <linux/kernel.h>
3534
#include <linux/lz4.h>
36-
#include <linux/module.h>
3735
#include <linux/mutex.h>
3836
#include <linux/spinlock.h>
3937
#include <linux/types.h>
@@ -142,12 +140,6 @@ static void finish_vdo_request_queue(void *ptr)
142140
vdo_unregister_allocating_thread();
143141
}
144142

145-
#ifdef MODULE
146-
#define MODULE_NAME THIS_MODULE->name
147-
#else
148-
#define MODULE_NAME "dm-vdo"
149-
#endif /* MODULE */
150-
151143
static const struct vdo_work_queue_type default_queue_type = {
152144
.start = start_vdo_request_queue,
153145
.finish = finish_vdo_request_queue,
@@ -559,8 +551,7 @@ int vdo_make(unsigned int instance, struct device_config *config, char **reason,
559551
*vdo_ptr = vdo;
560552

561553
snprintf(vdo->thread_name_prefix, sizeof(vdo->thread_name_prefix),
562-
"%s%u", MODULE_NAME, instance);
563-
BUG_ON(vdo->thread_name_prefix[0] == '\0');
554+
"vdo%u", instance);
564555
result = vdo_allocate(vdo->thread_config.thread_count,
565556
struct vdo_thread, __func__, &vdo->threads);
566557
if (result != VDO_SUCCESS) {

0 commit comments

Comments
 (0)