* [dm-devel] [bug report] dm mpath: add IO affinity path selector
@ 2020-11-13 12:09 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2020-11-13 12:09 UTC (permalink / raw
To: michael.christie; +Cc: dm-devel
Hello Mike Christie,
The patch c3d0a31e609e: "dm mpath: add IO affinity path selector"
from Oct 22, 2020, leads to the following static checker warning:
drivers/md/dm-ps-io-affinity.c:56 ioa_add_path()
error: uninitialized symbol 'cpu'.
drivers/md/dm-ps-io-affinity.c
43 static int ioa_add_path(struct path_selector *ps, struct dm_path *path,
44 int argc, char **argv, char **error)
45 {
46 struct selector *s = ps->context;
47 struct path_info *pi = NULL;
48 unsigned int cpu;
^^^^^^^^^^^^^^^^
49 int ret;
50
51 if (argc != 1) {
52 *error = "io-affinity ps: invalid number of arguments";
53 return -EINVAL;
54 }
55
56 pi = kzalloc_node(sizeof(*pi), GFP_KERNEL, cpu_to_node(cpu));
^^^
Unintialized
57 if (!pi) {
58 *error = "io-affinity ps: Error allocating path context";
59 return -ENOMEM;
60 }
61
62 pi->path = path;
63 path->pscontext = pi;
64 refcount_set(&pi->refcount, 1);
65
66 if (!zalloc_cpumask_var(&pi->cpumask, GFP_KERNEL)) {
67 *error = "io-affinity ps: Error allocating cpumask context";
68 ret = -ENOMEM;
69 goto free_pi;
70 }
71
72 ret = cpumask_parse(argv[0], pi->cpumask);
73 if (ret) {
74 *error = "io-affinity ps: invalid cpumask";
75 ret = -EINVAL;
76 goto free_mask;
77 }
78
79 for_each_cpu(cpu, pi->cpumask) {
80 if (cpu >= nr_cpu_ids) {
81 DMWARN_LIMIT("Ignoring mapping for CPU %u. Max CPU is %u\n",
82 cpu, nr_cpu_ids);
83 break;
84 }
85
86 if (s->path_map[cpu]) {
87 DMWARN("CPU mapping for %u exists. Ignoring.", cpu);
88 continue;
89 }
90
91 cpumask_set_cpu(cpu, s->path_mask);
92 s->path_map[cpu] = pi;
93 refcount_inc(&pi->refcount);
94 continue;
95 }
96
97 if (refcount_dec_and_test(&pi->refcount)) {
98 *error = "io-affinity ps: No new/valid CPU mapping found";
99 ret = -EINVAL;
100 goto free_mask;
101 }
102
103 return 0;
104
105 free_mask:
106 free_cpumask_var(pi->cpumask);
107 free_pi:
108 kfree(pi);
109 return ret;
regards,
dan carpenter
--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-11-13 12:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-13 12:09 [dm-devel] [bug report] dm mpath: add IO affinity path selector Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.