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:   Tue, 16 Aug 2022 10:01:28 -0600
From:   Jeffrey Hugo <quic_jhugo@...cinc.com>
To:     <decui@...rosoft.com>, <wei.liu@...nel.org>, <kys@...rosoft.com>,
        <haiyangz@...rosoft.com>, <sthemmin@...rosoft.com>,
        <lpieralisi@...nel.org>, <bhelgaas@...gle.com>,
        <linux-hyperv@...r.kernel.org>, <linux-pci@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>, <mikelley@...rosoft.com>,
        <robh@...nel.org>, <kw@...ux.com>, <helgaas@...nel.org>,
        <alex.williamson@...hat.com>, <boqun.feng@...il.com>,
        <Boqun.Feng@...rosoft.com>
CC:     Carl Vanderlip <quic_carlv@...cinc.com>
Subject: Re: [PATCH] PCI: hv: Fix the definiton of vector in
 hv_compose_msi_msg()

On 8/15/2022 12:55 PM, Dexuan Cui wrote:
> The local variable 'vector' must be u32 rather than u8: see the
> struct hv_msi_desc3.
> 
> 'vector_count' should be u16 rather than u8: see struct hv_msi_desc,
> hv_msi_desc2 and hv_msi_desc3.
> 
> Fixes: a2bad844a67b ("PCI: hv: Fix interrupt mapping for multi-MSI")
> Signed-off-by: Dexuan Cui <decui@...rosoft.com>
> Cc: Jeffrey Hugo <quic_jhugo@...cinc.com>
> Cc: Carl Vanderlip <quic_carlv@...cinc.com>
> ---
> 
> The patch should be appplied after the earlier patch:
>      [PATCH] PCI: hv: Only reuse existing IRTE allocation for Multi-MSI
>      https://lwn.net/ml/linux-kernel/20220804025104.15673-1-decui%40microsoft.com/
> 
>   drivers/pci/controller/pci-hyperv.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
> index 65d0dab25deb..53580899c859 100644
> --- a/drivers/pci/controller/pci-hyperv.c
> +++ b/drivers/pci/controller/pci-hyperv.c
> @@ -1614,7 +1614,7 @@ static void hv_pci_compose_compl(void *context, struct pci_response *resp,
>   
>   static u32 hv_compose_msi_req_v1(
>   	struct pci_create_interrupt *int_pkt, struct cpumask *affinity,
> -	u32 slot, u8 vector, u8 vector_count)
> +	u32 slot, u8 vector, u16 vector_count)
>   {
>   	int_pkt->message_type.type = PCI_CREATE_INTERRUPT_MESSAGE;
>   	int_pkt->wslot.slot = slot;
> @@ -1642,7 +1642,7 @@ static int hv_compose_msi_req_get_cpu(struct cpumask *affinity)
>   
>   static u32 hv_compose_msi_req_v2(
>   	struct pci_create_interrupt2 *int_pkt, struct cpumask *affinity,
> -	u32 slot, u8 vector, u8 vector_count)
> +	u32 slot, u8 vector, u16 vector_count)
>   {
>   	int cpu;
>   
> @@ -1661,7 +1661,7 @@ static u32 hv_compose_msi_req_v2(
>   
>   static u32 hv_compose_msi_req_v3(
>   	struct pci_create_interrupt3 *int_pkt, struct cpumask *affinity,
> -	u32 slot, u32 vector, u8 vector_count)
> +	u32 slot, u32 vector, u16 vector_count)
>   {
>   	int cpu;
>   
> @@ -1702,7 +1702,8 @@ static void hv_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
>   	struct tran_int_desc *int_desc;
>   	struct msi_desc *msi_desc;
>   	bool multi_msi;
> -	u8 vector, vector_count;
> +	u32 vector; /* Must be u32: see the struct hv_msi_desc3 */

Don't you need to cast this down to a u8 for v1 and v2?
Feels like this should be generating a compiler warning...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ