Re: [RFC wpan-tools] info: add frequency output to channel listing

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

 



On Fri, May 29, 2015 at 12:16:03PM +0000, Christoffer Holmstedt wrote:
>  
>  	if (tb_msg[NL802154_ATTR_CHANNEL])
> -		printf("current_channel: %d\n", nla_get_u8(tb_msg[NL802154_ATTR_CHANNEL]));
> +	{
> +		unsigned char curr_channel;
> +		curr_channel = nla_get_u8(tb_msg[NL802154_ATTR_CHANNEL]);
> +		printf("current_channel: %d (", curr_channel);
> +		print_freq(nla_get_u8(tb_msg[NL802154_ATTR_PAGE]), curr_channel);

Also this is problematic, because we don't check before if
tb_msg[NL802154_ATTR_PAGE] isn't null.

When you like to use this value there, the easiest way would be:

if (tb_msg[NL802154_ATTR_CHANNEL] && tb_msg[NL802154_ATTR_PAGE])

instead of

if (tb_msg[NL802154_ATTR_CHANNEL]) above.

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




[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux