lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 8 Apr 2024 03:41:46 +0000
From: <Arun.Ramadoss@...rochip.com>
To: <andrew@...n.ch>, <olteanv@...il.com>, <davem@...emloft.net>,
	<Woojung.Huh@...rochip.com>, <pabeni@...hat.com>, <o.rempel@...gutronix.de>,
	<edumazet@...gle.com>, <f.fainelli@...il.com>, <kuba@...nel.org>
CC: <kernel@...gutronix.de>, <dsahern@...nel.org>, <san@...v.dk>,
	<willemb@...gle.com>, <linux-kernel@...r.kernel.org>,
	<netdev@...r.kernel.org>, <horms@...nel.org>, <UNGLinuxDriver@...rochip.com>
Subject: Re: [PATCH net-next v3 8/9] net: dsa: microchip: init predictable IPV
 to queue mapping for all non KSZ8xxx variants

Hi Oleksij,

> +static int ksz9477_set_default_prio_queue_mapping(struct ksz_device
> *dev,
> +                                                 int port)
> +{
> +       u32 queue_map = 0;
> +       int ipv;

Just a suggestion for readability: if you can use common variable for
counter variable like cnt or n similar to return variable ret, it will
be easier to follow instead of ipv here, queue in other function. 

> +
> +       for (ipv = 0; ipv < dev->info->num_ipvs; ipv++) {
> +               int queue;
> +
> +               /* Traffic Type (TT) is corresponding to the Internal
> Priority
> +                * Value (IPV) in the switch. Traffic Class (TC) is
> +                * corresponding to the queue in the switch.
> +                */
> +               queue = ieee8021q_tt_to_tc(ipv, dev->info-
> >num_tx_queues);
> +               if (queue < 0)
> +                       return queue;

what happens if the num_tx_queues value passed is other than 1 to 8.
For ex: if it is 9, then ieee8021q_tt_to_tc( ) generates pr_warn as
invalid number of queue and return queue as 0. if will not execute, so
queue_map will be updated. Do we need check for valid range of values
instead of just queue < 0. 

Not sure this scenario can occur.  

> +
> +               queue_map |= queue << (ipv * KSZ9477_PORT_TC_MAP_S);
> +       }
> +
> +       return ksz_pwrite32(dev, port, KSZ9477_PORT_MRI_TC_MAP__4,
> queue_map);
> +}
> +
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ