Re: [PATCH_v4 1/5] android/hid: Fix set seport ipc cmd preparation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ravi,

On Fri, Nov 08, 2013, Ravi kumar Veeramally wrote:
> -	memcpy(cmd.data, report, cmd.len);
> +	memset(cmd, 0, sizeof(buf));

How about memset(buf, 0, sizeof(buf)) to make this perfectly clear. Btw,
why is the memset needed? I don't think the original code had it. Seems
like this is an independent bug fix?

> +	cmd->len = strlen(report);
> +	memcpy(cmd->data, report, cmd->len);
>  
>  	switch (report_type) {
>  	case BTHH_INPUT_REPORT:
> -		cmd.type = HAL_HIDHOST_INPUT_REPORT;
> +		cmd->type = HAL_HIDHOST_INPUT_REPORT;
>  		break;
>  	case BTHH_OUTPUT_REPORT:
> -		cmd.type = HAL_HIDHOST_OUTPUT_REPORT;
> +		cmd->type = HAL_HIDHOST_OUTPUT_REPORT;
>  		break;
>  	case BTHH_FEATURE_REPORT:
> -		cmd.type = HAL_HIDHOST_FEATURE_REPORT;
> +		cmd->type = HAL_HIDHOST_FEATURE_REPORT;
>  		break;
>  	default:
>  		return BT_STATUS_PARM_INVALID;
>  	}
>  
>  	return hal_ipc_cmd(HAL_SERVICE_ID_HIDHOST, HAL_OP_HIDHOST_SET_REPORT,
> -				sizeof(cmd), &cmd, 0, NULL, NULL);
> +					sizeof(buf), buf, 0, NULL, NULL);

This last call looks broken to me. Shouldn't you instead of sizeof(buf)
be sending sizeof(*cmd) + cmd->len?

Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux