Re: [Outreachy kernel] [PATCH v4] staging: unisys: visorhba: Convert module from IDR to XArray
From: Matthew Wilcox
Date: Tue Apr 27 2021 - 09:57:27 EST
On Tue, Apr 27, 2021 at 03:25:22PM +0200, Fabio M. De Francesco wrote:
> +++ b/drivers/staging/unisys/include/iochannel.h
> @@ -474,8 +474,8 @@ struct uiscmdrsp_scsitaskmgmt {
> enum task_mgmt_types tasktype;
> struct uisscsi_dest vdest;
> u64 handle;
> - u64 notify_handle;
> - u64 notifyresult_handle;
> + u32 notify_handle;
> + u32 notifyresult_handle;
> char result;
>
> #define TASK_MGMT_FAILED 0
I'm scared of this change. Read the top of the file:
* Everything needed for IOPart-GuestPart communication is define in
* this file. Note: Everything is OS-independent because this file is
* used by Windows, Linux and possible EFI drivers.
I don't know that you can make any changes to this file.
> +static void setup_scsitaskmgmt_handles(struct xarray *xa, struct uiscmdrsp *cmdrsp,
> wait_queue_head_t *event, int *result)
> {
> - /* specify the event that has to be triggered when this */
> - /* cmd is complete */
> - cmdrsp->scsitaskmgmt.notify_handle =
> - simple_idr_get(idrtable, event, lock);
> - cmdrsp->scsitaskmgmt.notifyresult_handle =
> - simple_idr_get(idrtable, result, lock);
> + int ret;
> + u32 *id;
> +
> + /* specify the event that has to be triggered when this cmd is complete */
> + id = &cmdrsp->scsitaskmgmt.notify_handle;
> + ret = xa_alloc_irq(xa, id, event, XA_LIMIT(1, INT_MAX), GFP_KERNEL);
You're still not handling the error here.