RE: staging: r8188eu: struct rt_firmware_header issues

From: David Laight
Date: Thu Apr 14 2022 - 04:42:09 EST


From: Michael Straube
> Sent: 13 April 2022 20:42
>
> On 4/13/22 18:27, Michael Straube wrote:
> > Hi all,
> >
> > I think the rt_firmware_hdr structure in rtw_fw.c has some issues.
> >
> >
> > struct rt_firmware_hdr {
> >     /*  8-byte alinment required */

Probably need an __aligned(8) at the bottom then?

> >     /*  LONG WORD 0 ---- */
> >     __le16        Signature;    /* 92C0: test chip; 92C,
> >                      * 88C0: test chip; 88C1: MP A-cut;
> >                      * 92C1: MP A-cut */
> >     u8        Category;    /*  AP/NIC and USB/PCI */
> >     u8        Function;    /*  Reserved for different FW function
> >                      *  indcation, for further use when
> >                      *  driver needs to download different
> >                      *  FW for different conditions */
> >     __le16        Version;    /*  FW Version */
> >     u8        Subversion;    /*  FW Subversion, default 0x00 */
> >     u16        Rsvd1;
> >
> >     /*  LONG WORD 1 ---- */
> >     u8        Month;    /*  Release time Month field */
> >     u8        Date;    /*  Release time Date field */
> >     u8        Hour;    /*  Release time Hour field */
> >     u8        Minute;    /*  Release time Minute field */
> >     __le16        RamCodeSize;    /*  The size of RAM code */
> >     u8        Foundry;
> >     u8        Rsvd2;
> >
> >     /*  LONG WORD 2 ---- */
> >     __le32        SvnIdx;    /*  The SVN entry index */
> >     u32        Rsvd3;
> >
> >     /*  LONG WORD 3 ---- */
> >     u32        Rsvd4;
> >     u32        Rsvd5;
> > };
...
>
> Ok, I figured it out by looking at the hexdumps of firmware files. The
> field Rsvd1 should be u8 instead of u16. I'll prepare a patch for this.

I'd also add a compile-time assert on the size.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)