Skip to contentSkip to conversation

Possible bug in ac_msg_is_request_for_ac

DISCUSSION Felix Obenhuber 2 participants 4 messages Jan 10, 2012 – Jan 11, 2012 CAN network drivers

lore
Share & tools
lore
#0 lore raw

Hi Kurt,

just wondered about the last line in ac_msg_is_request_for_ac
https://gitorious.org/~kurt-vd/linux-can/can-j1939-modules/blobs/master/net/can/j1939/address-claim.c

static inline int ac_msg_is_request_for_ac(struct sk_buff *skb)

{
        [...]
	req_pgn = skb->data[0] | (skb->data[1] << 8) | (skb->data[2] << 16);
	return req_pgn = PGN_ADDRESS_CLAIMED;
                    ^^^^^^

Think here's a equal sign missing cause you always return PGN_ADDRESS_CLAIMED.

Cheers,

Felix

#1 lore raw

Felix,

Thanks for pointing out this issue.

By a second look, this function is only used to decide if a request from source address 0xfe may be sent out.
I'm sure my intent is conform to the specification, but I'm not sure anymore taht I should enforce such policy inside the kernel.

I may as well delete the function completely ...

Any opinion?

Kurt

Quoted 26 lines · Felix Obenhuber

Hi Kurt,

just wondered about the last line in ac_msg_is_request_for_ac
https://gitorious.org/~kurt-vd/linux-can/can-j1939-modules/blobs/master/net/can/j1939/address-claim.c

static inline int ac_msg_is_request_for_ac(struct sk_buff *skb)

{
        [...]
	req_pgn = skb->data[0] | (skb->data[1] << 8) | (skb->data[2] << 16);
	return req_pgn = PGN_ADDRESS_CLAIMED;
                    ^^^^^^

Think here's a equal sign missing cause you always return PGN_ADDRESS_CLAIMED.

Cheers,

Felix

--
To unsubscribe from this list: send the line "unsubscribe linux-can" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw

Hi,

Quoted 4 lines · Kurt Van Dijck

By a second look, this function is only used to decide if a request from source address 0xfe may be sent out.
I'm sure my intent is conform to the specification, but I'm not sure anymore taht I should enforce such policy inside the kernel.

Yep, AFAIK this matches the J1939 and ISOBUS specification.

Quoted 1 line

I may as well delete the function completely ...

Maybe also a good solution, cause all the SA stuff is very simple and obvious. Everyone developing with SocketCAN J1939 should know about.

cheers,

Felix

#3 lore raw

Re: Bug in ac_msg_is_request_for_ac

Quoted 8 lines · Felix Obenhuber

Hi,

Quoted 4 lines · Kurt Van Dijck

By a second look, this function is only used to decide if a request from source address 0xfe may be sent out.
I'm sure my intent is conform to the specification, but I'm not sure anymore taht I should enforce such policy inside the kernel.

Quoted 6 lines

Yep, AFAIK this matches the J1939 and ISOBUS specification.

Quoted 1 line

I may as well delete the function completely ...

Maybe also a good solution, cause all the SA stuff is very simple and obvious. Everyone developing with SocketCAN J1939 should know about.

I just walked several scenarios, and the function must stay (patched), since it is only used in case of dynamic addressing, and in that case, one should not always care an address was claimed or not.

This should help userspace not to track address claims in _every_ program, which was one of the major intents to put it into kernel.

I'll push a commit shortly.

Thanks for the testing.
Regards,
Kurt