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

RE: [bluetooth-dev] question with bt_ioctl in bluetooth.c



[Sorry for the long delay in answering.]

> -----Original Message-----
> From: tliwant [mailto:tliwant@xxxxxxx.com]
> Sent: 23 February 2001 07:05
> To: bluetooth-dev@xxxxxxx.com
> Subject: [bluetooth-dev] question with bt_ioctl in bluetooth.c 
> 
>    Hello,all
>    When i read bluetooth.c file from axis,I have a question 
> with bt_ioctl.In the note,they said "The direction is a 
> bitmask, and VERIFY_WRITE catches R/W transfer.'Type' is 
> user-oriented, while verify_area is kernel-oriented, so the 
> concept of "read"and "write" is reversed".
>    But below that,they wrote
> if (_IOC_DIR(cmd) & _IOC_READ) {
> 	err = verify_area(VERIFY_READ, (void*)arg, size);
> 	if (err) 
>           BT_DRIVER("verify_area(VERIFY_READ) error:%d\n",err);
> } else if (_IOC_DIR(cmd) & _IOC_WRITE) {
> 	err = verify_area(VERIFY_WRITE, (void*)arg, size);
> 	if (err)
> 	BT_DRIVER("verify_area(VERIFY_WRITE) error:%d\n",err);
> }
> I think it might be
> if (_IOC_DIR(cmd) & _IOC_READ) {
> 	err = verify_area(VERIFY_WRITE, (void*)arg, size);
> 	if (err)
> 	BT_DRIVER("verify_area(VERIFY_WRITE) error:%d\n",err);
> } else if (_IOC_DIR(cmd) & _IOC_WRITE) {
> 	err = verify_area(VERIFY_READ, (void*)arg, size);
> 	if (err)
> 	BT_DRIVER("verify_area(VERIFY_READ) error:%d\n",err);
> }
>     Am i right?
> Pardon me for my poor English.

You are correct, and this has been changed in the latest version
of bluetooth.c

//Peter
-
To unsubscribe from this list: send the line "unsubscribe bluetooth-dev" in
the body of a message to majordomo@xxxxxxx.com