Re: [PATCH v2] scsi: target: fixup incorrect use of 'cpumask_t'

From: michael . christie
Date: Tue May 17 2022 - 20:33:54 EST


On 5/16/22 12:47 AM, mingzhe.zou@xxxxxxxxxxxx wrote:
> From: mingzhe <mingzhe.zou@xxxxxxxxxxxx>
>
> In commit d72d827f2f26, I used 'cpumask_t' incorrectly.
> ```
> void iscsit_thread_get_cpumask(struct iscsi_conn *conn)
> {
> int ord, cpu;
> cpumask_t conn_allowed_cpumask;
> ......
> }
>
> static ssize_t lio_target_wwn_cpus_allowed_list_store(
> struct config_item *item, const char *page, size_t count)
> {
> int ret;
> char *orig;
> cpumask_t new_allowed_cpumask;
> ......
> }
> ```
>
> So, that the correct pattern should be as follows:
> ```
> cpumask_var_t mask;
>
> if (!zalloc_cpumask_var(&mask, GFP_KERNEL))
> return -ENOMEM;
> ... use 'mask' here as a ...
> free_cpumask_var(mask);
> ```
>
> Fixes: d72d827f2f26 ("scsi: target: Add iscsi/cpus_allowed_list in configfs")
> Reported-by: Test Bot <zgrieee@xxxxxxxxx>
> Signed-off-by: mingzhe <mingzhe.zou@xxxxxxxxxxxx>
>

Reviewed-by: Mike Christie <michael.christie@xxxxxxxxxx>