[PATCHv4 12/16] staging: usbip: Pass session keys to the kernel

Dan Carpenter dan.carpenter at oracle.com
Fri Oct 25 15:02:51 UTC 2013


On Sat, Oct 19, 2013 at 04:39:15PM +0200, Dominik Paulus wrote:
> @@ -367,10 +367,17 @@ int usbip_host_export_device(struct usbip_exported_device *edev,
>  		return -1;
>  	}
>  
> -	snprintf(sockfd_buff, sizeof(sockfd_buff), "%d\n", conf->sockfd);
> -	dbg("write: %s", sockfd_buff);
> +	{
> +		char key1[33], key2[33];
> +		snprintf(sockfd_buff, sizeof(sockfd_buff), "%d %d %s %s\n",
> +				conf->sockfd, conf->use_crypto,
> +				keytohex(conf->key2, key2),
> +				keytohex(conf->key1, key1));
> +		dbg("write: %s", sockfd_buff);
> +	}

This is gross.  Don't do that.  My gut says to just delete the debug
code but I hate debug code by default.

> -	ret = sysfs_write_attribute(attr, sockfd_buff, strlen(sockfd_buff));
> +	ret = sysfs_write_attribute(attr, (const char *) sockfd_buff,

Don't put a space between the cast and the variable.

	ret = sysfs_write_attribute(attr, (const char *)sockfd_buff,

regards,
dan carpenter


More information about the devel mailing list