2024-03-12 21:27:48

by Ayush Tiwari

[permalink] [raw]
Subject: [PATCH] staging: rtl8712: removing redundant paranthesis chk_fwhdr

Removing redundant parentheses in 'if ((pfwhdr->signature != 0x8712) && (pfwhdr->signature != 0x8192))' in static u8 chk_fwhdr(struct fw_hdr *pfwhdr, u32 ulfilelength). This will ensure adherence to coding style guidelines

Signed-off-by: Ayush Tiwari <[email protected]>
---
drivers/staging/rtl8712/hal_init.c | 2 +-
key.pem | 28 ++++++++++++++++++++++++++++
staging | 1 +
3 files changed, 30 insertions(+), 1 deletion(-)
create mode 100644 key.pem
create mode 120000 staging

diff --git a/drivers/staging/rtl8712/hal_init.c b/drivers/staging/rtl8712/hal_init.c
index 1148075f0cd6..9f41b2c086ca 100644
--- a/drivers/staging/rtl8712/hal_init.c
+++ b/drivers/staging/rtl8712/hal_init.c
@@ -138,7 +138,7 @@ static u8 chk_fwhdr(struct fw_hdr *pfwhdr, u32 ulfilelength)
u32 fwhdrsz, fw_sz;

/* check signature */
- if ((pfwhdr->signature != 0x8712) && (pfwhdr->signature != 0x8192))
+ if (pfwhdr->signature != 0x8712 && pfwhdr->signature != 0x8192)
return _FAIL;
/* check fw_priv_sze & sizeof(struct fw_priv) */
if (pfwhdr->fw_priv_sz != sizeof(struct fw_priv))
diff --git a/key.pem b/key.pem
new file mode 100644
index 000000000000..ef912436e976
--- /dev/null
+++ b/key.pem
@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQC8i/6L5h4wSbaP
+tn9whe9BfKa0jpiiy+F9L0fJEWGKqUqxMUL3D48LJsqTgt8vP6ORMcSQmtQ1ijyv
+f9s0N5/sNci9dYeiVhzArlcZi4IOEkfkn/lgRoz4WOsZ6NQzgsk6ctctavrlHUwB
+e6RQHFyEC9BOmCq6PTPMtPTeTrQvjzm68gMiQfoNT86/uho+eKxABYBOZEN1DObt
+Q2wEbJOhiZ+UfknJd5Bux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YXyn0mD3ZMrOqsEKlSnA4EDfj
+kzXok9VoZ7XdT8HBqGjcGmpeAbomp2KFE2hYwZ6kPCouJj0F5EOLxVQNuh74XDnU
+LgwuICxXUwXF2aZg/immkVmx7inskDD3o9L9vBUCgYBhCpayQcy9hswdDVICOEst
+U9VXwVAbwfdmPTLiKacRQdw44zhBcsBB0wi1dszvGvSlAlB+ChFM6MxALEdbvTln
+Jxwsyxx9KXuoryhcTlHQikBOYxmrqPAhdrPh8H2tdiv2yX35x9g7E/XkRZZxMfkL
+H7x8vakFgGNcX2NITZBM4Q==
+-----END PRIVATE KEY-----
diff --git a/staging b/staging
new file mode 120000
index 000000000000..ecd48e46fcb1
--- /dev/null
+++ b/staging
@@ -0,0 +1 @@
+/home/ayush/git/kernels/staging
\ No newline at end of file
--
2.40.1



2024-03-12 21:52:25

by Julia Lawall

[permalink] [raw]
Subject: Re: [PATCH] staging: rtl8712: removing redundant paranthesis chk_fwhdr



On Wed, 13 Mar 2024, Ayush Tiwari wrote:

> Removing redundant parentheses in 'if ((pfwhdr->signature != 0x8712) && (pfwhdr->signature != 0x8192))' in static u8 chk_fwhdr(struct fw_hdr *pfwhdr, u32 ulfilelength). This will ensure adherence to coding style guidelines

The log message should be limited to 70 characters per line.

>
> Signed-off-by: Ayush Tiwari <[email protected]>
> ---
> drivers/staging/rtl8712/hal_init.c | 2 +-
> key.pem | 28 ++++++++++++++++++++++++++++
> staging | 1 +
> 3 files changed, 30 insertions(+), 1 deletion(-)
> create mode 100644 key.pem
> create mode 120000 staging
>
> diff --git a/drivers/staging/rtl8712/hal_init.c b/drivers/staging/rtl8712/hal_init.c
> index 1148075f0cd6..9f41b2c086ca 100644
> --- a/drivers/staging/rtl8712/hal_init.c
> +++ b/drivers/staging/rtl8712/hal_init.c
> @@ -138,7 +138,7 @@ static u8 chk_fwhdr(struct fw_hdr *pfwhdr, u32 ulfilelength)
> u32 fwhdrsz, fw_sz;
>
> /* check signature */
> - if ((pfwhdr->signature != 0x8712) && (pfwhdr->signature != 0x8192))
> + if (pfwhdr->signature != 0x8712 && pfwhdr->signature != 0x8192)

Actually, the response to another proposed patch was that it was preferred
to keep such parentheses, regardless of the ceckpatch warning.

> return _FAIL;
> /* check fw_priv_sze & sizeof(struct fw_priv) */
> if (pfwhdr->fw_priv_sz != sizeof(struct fw_priv))
> diff --git a/key.pem b/key.pem
> new file mode 100644
> index 000000000000..ef912436e976
> --- /dev/null
> +++ b/key.pem

I don't think that this is supposed to be part of the patch?

julia

> @@ -0,0 +1,28 @@
> +-----BEGIN PRIVATE KEY-----
> +MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQC8i/6L5h4wSbaP
> +tn9whe9BfKa0jpiiy+F9L0fJEWGKqUqxMUL3D48LJsqTgt8vP6ORMcSQmtQ1ijyv
> +f9s0N5/sNci9dYeiVhzArlcZi4IOEkfkn/lgRoz4WOsZ6NQzgsk6ctctavrlHUwB
> +e6RQHFyEC9BOmCq6PTPMtPTeTrQvjzm68gMiQfoNT86/uho+eKxABYBOZEN1DObt
> +Q2wEbJOhiZ+UfknJd5BuxLXFLLeutYNHT+jzymVETfH6Zqr5U+NS/68H8tVRSy5w
> +zwMZ38yQc5RI0fhI/u+6Lsikf0sJYV4sNaUkElclfzKFRE9RNc8McQcjbY8RUVvG
> +81qbKvDxAgMBAAECggEAB62YcpWu7LQmbpN10h0U1rEJpY2vB+Yklcal9jldJFqW
> +M5a4IuaBIpOe/ph+7Tt6tjrKxewVheP4v67bEYp4WpQAIOhXMH8Fkbp9H98Er1JY
> +QiZaRJeVkwwlRXtWn423vcfCcn409GftL0bxNIqgdod39qi6CLaIVFGZgoS9pWLD
> +lrrEnK8nlq8/4bs/bPyZqoiEIUXTC9IAHhlmmwL1diLYmTOTIFn0XN3kqxMwz50D
> +81Bh/pPZXXsL4f3an9v/68prsM4NgJMXvHh/qWGY8L75QyoPn69/6d4mETBDCSeL
> +BAA1Ac2z2UlC6uqlM5A4/F1IEilrtDIFMD6r3UMZDwKBgQD1Zbx3A3VV/HDlH2CN
> +Tzf/Er2xUPYbPHJCALbZVwEM8zNTeIysMM3LeqWXfbJ4JpfkU575QLCaAC1PdQJT
> +AjNLqo9eYzsir6pj18HqBN/MxIujhbLGA78oD5fYRTL+5sXl0m1xkJq+ngkWbx6Y
> +ByfZFZ/UIUMST8kU8nVlNuFN1wKBgQDEsXO0PH5f0RkdbRVBQvVIdj5kfR94bheW
> +s7apwU07uYvlLiLrikRgC3Q60a7K3H7tfxkP5rjKUr+CyH+rlsL+WL4gJjBi4D13
> +XQeFlNbZieNNrnOctFCnGPlUSmte4Ubd1QEplUkbYkfvh5XKIklAfLsQPf17FQr/
> +ZAE/2YIOdwKBgGfXCQ0DdZ9RFySdRmoFX5icAZEKxVl5FpA/ZSBK5LLqJonntP8Y
> +F71GxNN56Q9WpWeEyvyGFzTTZlj9FmKxx6r5HXm/W8KtuthM8E1qiplHgh9L7/5C
> +j50QHBz0C0Q5uvwpMw6fNhv7G7VWiAek34PI1r0Y5hzVji1C+9I8itI5AoGAYGsU
> +at/UmyenBhO4/ZrTHkhIYX4sdR6SlZ9XBXPqZkKYXyn0mD3ZMrOqsEKlSnA4EDfj
> +kzXok9VoZ7XdT8HBqGjcGmpeAbomp2KFE2hYwZ6kPCouJj0F5EOLxVQNuh74XDnU
> +LgwuICxXUwXF2aZg/immkVmx7inskDD3o9L9vBUCgYBhCpayQcy9hswdDVICOEst
> +U9VXwVAbwfdmPTLiKacRQdw44zhBcsBB0wi1dszvGvSlAlB+ChFM6MxALEdbvTln
> +Jxwsyxx9KXuoryhcTlHQikBOYxmrqPAhdrPh8H2tdiv2yX35x9g7E/XkRZZxMfkL
> +H7x8vakFgGNcX2NITZBM4Q==
> +-----END PRIVATE KEY-----
> diff --git a/staging b/staging
> new file mode 120000
> index 000000000000..ecd48e46fcb1
> --- /dev/null
> +++ b/staging
> @@ -0,0 +1 @@
> +/home/ayush/git/kernels/staging
> \ No newline at end of file
> --
> 2.40.1
>
>
>

2024-03-13 13:04:33

by Bagas Sanjaya

[permalink] [raw]
Subject: Re: [PATCH] staging: rtl8712: removing redundant paranthesis chk_fwhdr

On Wed, Mar 13, 2024 at 02:54:39AM +0530, Ayush Tiwari wrote:
> diff --git a/drivers/staging/rtl8712/hal_init.c b/drivers/staging/rtl8712/hal_init.c
> index 1148075f0cd6..9f41b2c086ca 100644
> --- a/drivers/staging/rtl8712/hal_init.c
> +++ b/drivers/staging/rtl8712/hal_init.c
> @@ -138,7 +138,7 @@ static u8 chk_fwhdr(struct fw_hdr *pfwhdr, u32 ulfilelength)
> u32 fwhdrsz, fw_sz;
>
> /* check signature */
> - if ((pfwhdr->signature != 0x8712) && (pfwhdr->signature != 0x8192))
> + if (pfwhdr->signature != 0x8712 && pfwhdr->signature != 0x8192)
> return _FAIL;
> /* check fw_priv_sze & sizeof(struct fw_priv) */
> if (pfwhdr->fw_priv_sz != sizeof(struct fw_priv))

Hi Ayush,

As Julia has said earlier, keep the parentheses as is (hint: search
lore.kernel.org for why Greg doesn't like fixing unnecessary parentheses).

> diff --git a/key.pem b/key.pem
> new file mode 100644
> index 000000000000..ef912436e976
> --- /dev/null
> +++ b/key.pem
> @@ -0,0 +1,28 @@
> +-----BEGIN PRIVATE KEY-----
> +MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQC8i/6L5h4wSbaP
> +tn9whe9BfKa0jpiiy+F9L0fJEWGKqUqxMUL3D48LJsqTgt8vP6ORMcSQmtQ1ijyv
> +f9s0N5/sNci9dYeiVhzArlcZi4IOEkfkn/lgRoz4WOsZ6NQzgsk6ctctavrlHUwB
> +e6RQHFyEC9BOmCq6PTPMtPTeTrQvjzm68gMiQfoNT86/uho+eKxABYBOZEN1DObt
> +Q2wEbJOhiZ+UfknJd5BuxLXFLLeutYNHT+jzymVETfH6Zqr5U+NS/68H8tVRSy5w
> +zwMZ38yQc5RI0fhI/u+6Lsikf0sJYV4sNaUkElclfzKFRE9RNc8McQcjbY8R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uh74XDnU
> +LgwuICxXUwXF2aZg/immkVmx7inskDD3o9L9vBUCgYBhCpayQcy9hswdDVICOEst
> +U9VXwVAbwfdmPTLiKacRQdw44zhBcsBB0wi1dszvGvSlAlB+ChFM6MxALEdbvTln
> +Jxwsyxx9KXuoryhcTlHQikBOYxmrqPAhdrPh8H2tdiv2yX35x9g7E/XkRZZxMfkL
> +H7x8vakFgGNcX2NITZBM4Q==
> +-----END PRIVATE KEY-----

Please don't leak (x509) private key. If so, generate new one instead.
If you intend to sign your patch, you can use patatt (see [1] for usage),
although you have to use a GPG keypair for that.

> diff --git a/staging b/staging
> new file mode 120000
> index 000000000000..ecd48e46fcb1
> --- /dev/null
> +++ b/staging
> @@ -0,0 +1 @@
> +/home/ayush/git/kernels/staging
> \ No newline at end of file
> --
> 2.40.1
>

What's the purpose of above file? I'm confused.

Thanks.

[1]: https://people.kernel.org/monsieuricon/end-to-end-patch-attestation-with-patatt-and-b4

--
An old man doll... just what I always wanted! - Clara


Attachments:
(No filename) (3.39 kB)
signature.asc (235.00 B)
Download all attachments