Skip to content

Conversation

@opsiff
Copy link
Member

@opsiff opsiff commented Nov 21, 2025

Mauro Carvalho Chehab (1):
media: av7110: fix a spectre vulnerability

Stefan Herdler (19):
media: av7110: remove budget-patch driver
media: sp8870: coding style fixes: whitespace
media: sp8870: coding style fixes: newline, comments and braces
media: sp8870: coding style fixes: miscellaneous
media: sp8870: coding style fixes: logging
media: av7110: coding style fixes: pointer_location
media: av7110: coding style fixes: blank lines
media: av7110: coding style fixes: whitespace
media: av7110: coding style fixes: newline
media: av7110: coding style fixes: whitespace (strict)
media: av7110: coding style fixes: comments
media: av7110: coding style fixes: braces
media: av7110: coding style fixes: assignments
media: av7110: coding style fixes: comparsations
media: av7110: coding style fixes: sizeof
media: av7110: coding style fixes: variable types
media: av7110: coding style fixes: miscellaneous
media: av7110: coding style fixes: deep_indentation
media: av7110: coding style fixes: logging

drivers/staging/media/av7110/Kconfig | 22 -
drivers/staging/media/av7110/Makefile | 2 -
drivers/staging/media/av7110/av7110.c | 496 +++++++--------
drivers/staging/media/av7110/av7110.h | 40 +-
drivers/staging/media/av7110/av7110_av.c | 234 +++----
drivers/staging/media/av7110/av7110_av.h | 5 +-
drivers/staging/media/av7110/av7110_ca.c | 68 +-
drivers/staging/media/av7110/av7110_hw.c | 230 ++++---
drivers/staging/media/av7110/av7110_hw.h | 53 +-
drivers/staging/media/av7110/av7110_ipack.c | 282 ++++-----
drivers/staging/media/av7110/av7110_ir.c | 3 +-
drivers/staging/media/av7110/av7110_v4l.c | 102 +--
drivers/staging/media/av7110/budget-patch.c | 665 --------------------
drivers/staging/media/av7110/dvb_filter.c | 116 ++--
drivers/staging/media/av7110/dvb_filter.h | 22 +-
drivers/staging/media/av7110/sp8870.c | 200 +++---
drivers/staging/media/av7110/sp8870.h | 24 +-
17 files changed, 915 insertions(+), 1649 deletions(-)
delete mode 100644 drivers/staging/media/av7110/budget-patch.c

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @opsiff, your pull request is larger than the review limit of 150000 diff characters

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from opsiff. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR backports upstream changes to fix a Spectre vulnerability in the av7110 media driver along with extensive coding style improvements. The changes include removal of old documentation files and the budget-patch driver, plus comprehensive coding style fixes across the av7110 codebase to improve maintainability and address checkpatch warnings.

Key changes:

  • Fixes a Spectre vulnerability using array_index_nospec()
  • Removes obsolete documentation files (60+ .rst files)
  • Removes budget-patch driver
  • Applies extensive coding style fixes for whitespace, braces, comments, pointer locations, assignments, comparisons, sizeof usage, and logging

Reviewed Changes

Copilot reviewed 67 out of 67 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
av7110_ca.c Spectre vulnerability fix with array_index_nospec()
av7110.h Coding style fixes and pr_fmt macro addition
av7110_av.c/h Extensive coding style corrections
av7110_hw.c/h Coding style fixes and improved error messages
av7110_v4l.c Whitespace and formatting improvements
sp8870.c/h Comprehensive coding style updates
dvb_filter.c/h Formatting and style corrections
budget-patch.c File removed
*.rst files Documentation files removed

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copyright (C) 1999 Juergen Peitz
* Driver for Spase SP8870 demodulator
.*
Copy link

Copilot AI Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: stray period and asterisk on line 4. Should be ' ' not '.'.

Copilot uses AI. Check for mistakes.
switch (data[0]) {
case CI_MSG_CI_INFO:
if (data[2] != 1 && data[2] != 2)
if (data[2] != 1 && data[2] != MAX_CI_SLOTS)
Copy link

Copilot AI Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bounds check on line 37 validates against MAX_CI_SLOTS (value 2), but data[2] can be 1 or 2. When data[2] is 2, the expression 'data[2] - 1' equals 1, which is valid. However, the check should be 'data[2] < 1 || data[2] > MAX_CI_SLOTS' to properly validate that data[2] is in the range [1, MAX_CI_SLOTS]. The current check allows data[2] to be any value except 1 and 2, which is incorrect.

Suggested change
if (data[2] != 1 && data[2] != MAX_CI_SLOTS)
if (data[2] < 1 || data[2] > MAX_CI_SLOTS)

Copilot uses AI. Check for mistakes.
Stefan Herdler added 19 commits November 21, 2025 15:18
This patch removes the budget-patch stand alone driver only.
This patch does *not* remove the budget-patch support from the av7110
     (= dvb-ttpci) driver.
This patch does also *not* remove the support for the full-ts mod.

The budget-patch is an obsolete, experimental hardware modification, which
aimed to receive the whole transport stream of a transponder by bypassing
the av7110. This modification never worked reliably enough to be used in a
productive environment.
"almost no packet loss" [budget-patch.c deepin-community#522] is still a packet loss.

The successor of the budget-patch is the full-ts mod, which is reliable.
The full-ts mod circuit is found on the never rev. 2.2 and 2.3 DVB-S
cards ex factory. The full-ts mod support is (only) in the av7110
(= dvb-ttpci) driver.

The budget-patch driver is a stand alone driver, which turns the card into
a budget card. It doesn't appear to be ever intended for the average user.
"Card is required to have loaded firmware to tune properly. Firmware can
be loaded by insertion and removal of standard av7110 driver prior to
loading this driver." [Kconfig]

There is support for the budget-patch in the av7110 (= dvb-ttpci) driver
too, which isn't affected by this patch.

The budget-patch is obsolete and replaced by the full-ts mod quiet a while
now. Remove the budget-patch driver left over from development.

Signed-off-by: Stefan Herdler <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
(cherry picked from commit 95ccc5b)
Stable-dep-of: 458ea1c ("media: av7110: fix a spectre vulnerability")
Signed-off-by: Wentao Guan <[email protected]>
This patch fixes the following checkpatch warnings:

ERROR:BRACKET_SPACE: space prohibited before open square bracket '['
ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
ERROR:POINTER_LOCATION: "foo* bar" should be "foo *bar"
ERROR:SPACING: space prohibited before that ',' (ctx:WxW)
ERROR:SPACING: space required before the open brace '{'
WARNING:SPACING: space prohibited between function name and open parenthesis '('
CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis

Whitespace changes only.
"git diff -w" shows no changes.

Signed-off-by: Stefan Herdler <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
(cherry picked from commit 5a053c0)
Stable-dep-of: 458ea1c ("media: av7110: fix a spectre vulnerability")
Signed-off-by: Wentao Guan <[email protected]>
This patch fixes the following checkpatch warnings:

ERROR:OPEN_BRACE: open brace '{' following struct go on the same line
ERROR:TRAILING_STATEMENTS: trailing statements should be on next line [*]
WARNING:LINE_SPACING: Missing a blank line after declarations
WARNING:BLOCK_COMMENT_STYLE: Block comments use a trailing */ on a separate line
WARNING:BLOCK_COMMENT_STYLE: Block comments use * on subsequent lines
CHECK:BRACES: Blank lines aren't necessary after an open brace '{'
CHECK:LINE_SPACING: Please don't use multiple blank lines
CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations

Except the 2 comment-blocks, newline changes only.
[* The remaining trailing statement will be fixed in the logging patch.]

Signed-off-by: Stefan Herdler <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
(cherry picked from commit 5f0edb7)
Stable-dep-of: 458ea1c ("media: av7110: fix a spectre vulnerability")
Signed-off-by: Wentao Guan <[email protected]>
This patch fixes the following checkpatch:

ERROR:ASSIGN_IN_IF: do not use assignment in if condition
WARNING:BRACES: braces {} are not necessary for any arm of this statement
WARNING:CONST_STRUCT: struct dvb_frontend_ops should normally be const
WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable
CHECK:ALLOC_SIZEOF_STRUCT: Prefer kzalloc(sizeof(*state)...) over kzalloc(sizeof(struct sp8870_state)...)
CHECK:AVOID_EXTERNS: extern prototypes should be avoided in .h files
CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written ...
CHECK:MULTIPLE_ASSIGNMENTS: multiple assignments should be avoided

Signed-off-by: Stefan Herdler <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
(cherry picked from commit 72707bd)
Stable-dep-of: 458ea1c ("media: av7110: fix a spectre vulnerability")
Signed-off-by: Wentao Guan <[email protected]>
This patch fixes the following checkpatch warnings:

WARNING:PREFER_PR_LEVEL: Prefer [subsystem eg: netdev]_dbg([subsystem]dev, ... then dev_dbg(dev, ... then pr_debug(...  to printk(KERN_DEBUG ...
WARNING:PRINTK_WITHOUT_KERN_LEVEL: printk() should include KERN_<LEVEL> facility level
WARNING:TRACING_LOGGING: Unnecessary ftrace-like logging - prefer using ftrace
ERROR:TRAILING_STATEMENTS: trailing statements should be on next line

Convert logging to the recommend pr_* macros.

Signed-off-by: Stefan Herdler <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
(cherry picked from commit 47da4d1)
Stable-dep-of: 458ea1c ("media: av7110: fix a spectre vulnerability")
Signed-off-by: Wentao Guan <[email protected]>
This patch fixes the following checkpatch warnings:

ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
ERROR:POINTER_LOCATION: "foo* bar" should be "foo *bar"
ERROR:POINTER_LOCATION: "(foo*)" should be "(foo *)"

Whitespace changes only.
"git diff -w" shows no changes.

Signed-off-by: Stefan Herdler <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
(cherry picked from commit 3b013d8)
Stable-dep-of: 458ea1c ("media: av7110: fix a spectre vulnerability")
Signed-off-by: Wentao Guan <[email protected]>
This patch fixes the following checkpatch warnings:

CHECK:LINE_SPACING: Please don't use multiple blank lines
CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations
CHECK:BRACES: Blank lines aren't necessary after an open brace '{'
CHECK:BRACES: Blank lines aren't necessary before a close brace '}'
WARNING:LINE_SPACING: Missing a blank line after declarations

Added or removed blank lines only.
"git diff --ignore-blank-lines" shows no changes.

Signed-off-by: Stefan Herdler <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
(cherry picked from commit a070650)
Stable-dep-of: 458ea1c ("media: av7110: fix a spectre vulnerability")
Signed-off-by: Wentao Guan <[email protected]>
This patch fixes the following checkpatch warnings:

ERROR:SPACING: need consistent spacing around '&' (ctx:WxO)
ERROR:SPACING: need consistent spacing around '&' (ctx:WxV)
ERROR:SPACING: need consistent spacing around '-' (ctx:WxV)
ERROR:SPACING: space prohibited after that '~' (ctx:OxW)
ERROR:SPACING: space prohibited after that open parenthesis '('
ERROR:SPACING: space prohibited before that close parenthesis ')'
ERROR:SPACING: space prohibited before that ':' (ctx:WxE)
ERROR:SPACING: space prohibited before that ',' (ctx:WxW)
ERROR:SPACING: space required after that ',' (ctx:VxV)
ERROR:SPACING: space required before that '-' (ctx:OxV)
ERROR:SPACING: space required before that '~' (ctx:OxV)
ERROR:SPACING: space required before the open brace '{'
ERROR:SPACING: space required before the open parenthesis '('
ERROR:SPACING: spaces required around that '&&' (ctx:ExV)
ERROR:SPACING: spaces required around that '!=' (ctx:VxO)
ERROR:SPACING: spaces required around that '&=' (ctx:VxO)
ERROR:SPACING: spaces required around that '==' (ctx:VxO)
ERROR:SPACING: spaces required around that '!=' (ctx:VxV)
ERROR:SPACING: spaces required around that '+=' (ctx:VxV)
ERROR:SPACING: spaces required around that '-=' (ctx:VxV)
ERROR:SPACING: spaces required around that '<' (ctx:VxV)
ERROR:SPACING: spaces required around that '<=' (ctx:VxV)
ERROR:SPACING: spaces required around that '=' (ctx:VxV)
ERROR:SPACING: spaces required around that '>' (ctx:VxV)
ERROR:SPACING: spaces required around that '>=' (ctx:VxV)
ERROR:SPACING: spaces required around that '|=' (ctx:VxV)
WARNING:LEADING_SPACE: please, no spaces at the start of a line
WARNING:QUOTED_WHITESPACE_BEFORE_NEWLINE: unnecessary whitespace before a quoted newline
WARNING:SPACING: space prohibited before semicolon
WARNING:SPACING: space prohibited between function name and open parenthesis '('
WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional statements (16, 23)
WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional statements (16, 32)
WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional statements (32, 39)
WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional statements (39, 47)
WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional statements (47, 55)
WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional statements (8, 18)
WARNING:TABSTOP: Statements should start on a tabstop
CHECK:SPACING: No space is necessary after a cast
CHECK:SPACING: space preferred before that '|' (ctx:VxE)
CHECK:SPACING: spaces preferred around that '&' (ctx:VxV)
CHECK:SPACING: spaces preferred around that '*' (ctx:VxV)
CHECK:SPACING: spaces preferred around that '+' (ctx:VxV)
CHECK:SPACING: spaces preferred around that '-' (ctx:VxV)
CHECK:SPACING: spaces preferred around that '/' (ctx:VxV)
CHECK:SPACING: spaces preferred around that '<<' (ctx:VxV)
CHECK:SPACING: spaces preferred around that '>>' (ctx:VxV)
CHECK:SPACING: spaces preferred around that '|' (ctx:VxV)

Whitespace changes only.
"git diff -w" shows no changes.

Signed-off-by: Stefan Herdler <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
(cherry picked from commit 83ab913)
Stable-dep-of: 458ea1c ("media: av7110: fix a spectre vulnerability")
Signed-off-by: Wentao Guan <[email protected]>
This patch fixes the following checkpatch warnings:

ERROR:ELSE_AFTER_BRACE: else should follow close brace '}'
ERROR:OPEN_BRACE: open brace '{' following enum go on the same line
ERROR:OPEN_BRACE: open brace '{' following struct go on the same line
ERROR:OPEN_BRACE: that open brace { should be on the previous line
ERROR:TRAILING_STATEMENTS: trailing statements should be on next line
CHECK:LOGICAL_CONTINUATIONS: Logical continuations should be on the previous line

Newline and whitespace changes only.

Signed-off-by: Stefan Herdler <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
(cherry picked from commit 2ee76a6)
Stable-dep-of: 458ea1c ("media: av7110: fix a spectre vulnerability")
Signed-off-by: Wentao Guan <[email protected]>
This patch fixes the following checkpatch warnings:

CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
CHECK:SPACING: No space is necessary after a cast
CHECK:SPACING: space preferred before that '|' (ctx:VxE)
CHECK:SPACING: spaces preferred around that '&' (ctx:VxV)
CHECK:SPACING: spaces preferred around that '*' (ctx:VxV)
CHECK:SPACING: spaces preferred around that '+' (ctx:VxV)
CHECK:SPACING: spaces preferred around that '-' (ctx:VxV)
CHECK:SPACING: spaces preferred around that '/' (ctx:VxV)
CHECK:SPACING: spaces preferred around that '<<' (ctx:VxV)
CHECK:SPACING: spaces preferred around that '>>' (ctx:VxV)
CHECK:SPACING: spaces preferred around that '|' (ctx:VxV)

Additional whitespace fixes found by "checkpatch.pl --strict".

Whitespace changes only.
"git diff -w" shows no changes.

Signed-off-by: Stefan Herdler <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
(cherry picked from commit 8e01620)
Stable-dep-of: 458ea1c ("media: av7110: fix a spectre vulnerability")
Signed-off-by: Wentao Guan <[email protected]>
This patch fixes the following checkpatch warnings:

WARNING:BLOCK_COMMENT_STYLE: Block comments use a trailing */ on a separate line
WARNING:BLOCK_COMMENT_STYLE: Block comments use * on subsequent lines
WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier tag in line 1
WARNING:EMBEDDED_FILENAME: It's generally not useful to have the filename in the file

Signed-off-by: Stefan Herdler <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
(cherry picked from commit 043dc67)
Stable-dep-of: 458ea1c ("media: av7110: fix a spectre vulnerability")
Signed-off-by: Wentao Guan <[email protected]>
This patch fixes the following checkpatch warnings and errors:

WARNING:BRACES: braces {} are not necessary for any arm of this statement
WARNING:BRACES: braces {} are not necessary for single statement blocks
CHECK:BRACES: braces {} should be used on all arms of this statement
CHECK:BRACES: Unbalanced braces around else statement

Signed-off-by: Stefan Herdler <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
(cherry picked from commit 28ada7d)
Stable-dep-of: 458ea1c ("media: av7110: fix a spectre vulnerability")
Signed-off-by: Wentao Guan <[email protected]>
This patch fixes the following checkpatch errors:

ERROR:ASSIGN_IN_IF: do not use assignment in if condition
CHECK:MULTIPLE_ASSIGNMENTS: multiple assignments should be avoided

Signed-off-by: Stefan Herdler <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
(cherry picked from commit e198cab)
Stable-dep-of: 458ea1c ("media: av7110: fix a spectre vulnerability")
Signed-off-by: Wentao Guan <[email protected]>
This patch fixes the following checkpatch warnings:

WARNING:CONSTANT_COMPARISON: Comparisons should place the constant on the right side of the test
CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written ...

Signed-off-by: Stefan Herdler <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
(cherry picked from commit 3c08dc3)
Stable-dep-of: 458ea1c ("media: av7110: fix a spectre vulnerability")
Signed-off-by: Wentao Guan <[email protected]>
This patch fixes the following checkpatch warnings:

WARNING:SIZEOF_PARENTHESIS: sizeof d should be sizeof(d)
WARNING:SIZEOF_PARENTHESIS: sizeof f->fmt.sliced should be sizeof(f->fmt.sliced)
WARNING:CONST_STRUCT: struct dvb_frontend_ops should normally be const
CHECK:ALLOC_SIZEOF_STRUCT: Prefer kzalloc(sizeof(*av7110)...) over kzalloc(sizeof(struct av7110)...)

Signed-off-by: Stefan Herdler <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
(cherry picked from commit e7b9b55)
Stable-dep-of: 458ea1c ("media: av7110: fix a spectre vulnerability")
Signed-off-by: Wentao Guan <[email protected]>
This patch fixes the following checkpatch warnings:

CHECK:PREFER_KERNEL_TYPES: Prefer kernel type 's32' over 'int32_t'
CHECK:PREFER_KERNEL_TYPES: Prefer kernel type 'u64' over 'uint64_t'
WARNING:UNNECESSARY_INT: Prefer 'long' over 'long int' as the int is unnecessary
WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned'

Signed-off-by: Stefan Herdler <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
(cherry picked from commit a6257cc)
Stable-dep-of: 458ea1c ("media: av7110: fix a spectre vulnerability")
Signed-off-by: Wentao Guan <[email protected]>
This patch fixes the following checkpatch warnings:

WARNING:OOM_MESSAGE: Possible unnecessary 'out of memory' message
CHECK:MACRO_ARG_REUSE: Macro argument reuse 'fe_func' - possible side-effects?

The MACRO_ARG_REUSE isn't really fixed but marked as intentional.
The comment is visible in the checkpatch warning.

Signed-off-by: Stefan Herdler <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
(cherry picked from commit 64b8402)
Stable-dep-of: 458ea1c ("media: av7110: fix a spectre vulnerability")
Signed-off-by: Wentao Guan <[email protected]>
This patch fixes most the following checkpatch warnings:

WARNING:DEEP_INDENTATION: Too many leading tabs - consider code refactoring

Invert "if" statement to reduce indention level by 1.

Signed-off-by: Stefan Herdler <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
(cherry picked from commit 908b202)
Stable-dep-of: 458ea1c ("media: av7110: fix a spectre vulnerability")
Signed-off-by: Wentao Guan <[email protected]>
This patch fixes the following checkpatch warnings:

CHECK:MACRO_ARG_PRECEDENCE: Macro argument 'level' may be better as '(level)' to avoid precedence issues
WARNING:EMBEDDED_FUNCTION_NAME: Prefer using '"%s...", __func__' to using 'av7110_bootarm', this function's name, in a string
WARNING:EMBEDDED_FUNCTION_NAME: Prefer using '"%s...", __func__' to using 'av7110_diseqc_send', this function's name, in a string
WARNING:EMBEDDED_FUNCTION_NAME: Prefer using '"%s...", __func__' to using 'av7110_fw_cmd', this function's name, in a string
WARNING:EMBEDDED_FUNCTION_NAME: Prefer using '"%s...", __func__' to using 'av7110_fw_query', this function's name, in a string
WARNING:EMBEDDED_FUNCTION_NAME: Prefer using '"%s...", __func__' to using 'av7110_fw_request', this function's name, in a string
WARNING:EMBEDDED_FUNCTION_NAME: Prefer using '"%s...", __func__' to using 'av7110_osd_cmd', this function's name, in a string
WARNING:EMBEDDED_FUNCTION_NAME: Prefer using '"%s...", __func__' to using 'av7110_send_ci_cmd', this function's name, in a string
WARNING:EMBEDDED_FUNCTION_NAME: Prefer using '"%s...", __func__' to using 'av7110_send_fw_cmd', this function's name, in a string
WARNING:EMBEDDED_FUNCTION_NAME: Prefer using '"%s...", __func__' to using 'gpioirq', this function's name, in a string
WARNING:EMBEDDED_FUNCTION_NAME: Prefer using '"%s...", __func__' to using 'load_dram', this function's name, in a string
WARNING:EMBEDDED_FUNCTION_NAME: Prefer using '"%s...", __func__' to using 'ReleaseBitmap', this function's name, in a string
WARNING:EMBEDDED_FUNCTION_NAME: Prefer using '"%s...", __func__' to using 'vpeirq', this function's name, in a string
WARNING:EMBEDDED_FUNCTION_NAME: Prefer using '"%s...", __func__' to using 'WriteText', this function's name, in a string
WARNING:LOGGING_CONTINUATION: Avoid logging continuation uses where feasible
WARNING:PREFER_PR_LEVEL: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(...  to printk(KERN_CONT ...
WARNING:PREFER_PR_LEVEL: Prefer [subsystem eg: netdev]_dbg([subsystem]dev, ... then dev_dbg(dev, ... then pr_debug(...  to printk(KERN_DEBUG ...
WARNING:PREFER_PR_LEVEL: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(...  to printk(KERN_ERR ...
WARNING:PREFER_PR_LEVEL: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(...  to printk(KERN_INFO ...
WARNING:PREFER_PR_LEVEL: Prefer [subsystem eg: netdev]_warn([subsystem]dev, ... then dev_warn(dev, ... then pr_warn(...  to printk(KERN_WARNING ...
WARNING:PRINTK_WITHOUT_KERN_LEVEL: printk() should include KERN_<LEVEL> facility level
WARNING:TRACING_LOGGING: Unnecessary ftrace-like logging - prefer using ftrace

There where different logging styles in this drivers.
Convert everything to the recommend pr_* macros.

Log messages should mostly be unchanged by this patch.

Signed-off-by: Stefan Herdler <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
(cherry picked from commit f6ed894)
Stable-dep-of: 458ea1c ("media: av7110: fix a spectre vulnerability")
Signed-off-by: Wentao Guan <[email protected]>
@opsiff opsiff force-pushed the linux-6.6.y-2025-11-21-CVE-2024-50289 branch from 386b614 to c5a0bae Compare November 21, 2025 07:18
mainline inclusion
from mainline-v6.12-rc7
category: bugfix
CVE: CVE-2024-50289

As warned by smatch:
	drivers/staging/media/av7110/av7110_ca.c:270 dvb_ca_ioctl() warn: potential spectre issue 'av7110->ci_slot' [w] (local cap)

There is a spectre-related vulnerability at the code. Fix it.

Fixes: 1da177e ("Linux-2.6.12-rc2")
Cc: [email protected]
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
(cherry picked from commit 458ea1c)
[Backport to 6.6 include an extra nospec.h for we not include linux/nospec.h in linux/uaccess.h now]
Signed-off-by: Wentao Guan <[email protected]>
@opsiff opsiff force-pushed the linux-6.6.y-2025-11-21-CVE-2024-50289 branch from c5a0bae to 039fbbe Compare November 21, 2025 10:38
@deepin-ci-robot
Copy link

deepin pr auto review

我来分析这个git diff中的代码变更。这个变更主要涉及AV7110驱动程序的代码清理和优化。我将从语法逻辑、代码质量、代码性能和代码安全四个方面进行分析。

  1. 语法逻辑改进:
  • 移除了不必要的空行和注释
  • 统一了代码格式和缩进
  • 修复了一些变量声明和初始化的问题
  • 改进了函数参数的类型声明
  1. 代码质量改进:
  • 添加了pr_fmt宏定义,统一了日志格式
  • 改进了错误处理和日志输出
  • 使用了更安全的函数调用方式
  • 优化了条件判断的逻辑
  1. 代码性能改进:
  • 优化了循环和条件判断的结构
  • 减少了不必要的函数调用
  • 改进了内存访问模式
  • 优化了数据传输的实现
  1. 代码安全改进:
  • 添加了边界检查
  • 改进了输入验证
  • 使用了更安全的内存操作函数
  • 加强了错误处理

具体改进建议:

  1. 语法逻辑方面:
  • 在av7110.c中,将"long int"改为"long"更符合现代C语言风格
  • 在sp8870.c中,改进了函数参数的声明方式,使用更清晰的类型声明
  1. 代码质量方面:
  • 统一使用pr_info/pr_err等日志函数,替代printk
  • 在错误处理路径中添加更详细的错误信息
  • 改进了函数的返回值处理
  1. 代码性能方面:
  • 在循环中使用更高效的判断方式
  • 减少了不必要的内存拷贝操作
  • 优化了数据结构的使用
  1. 代码安全方面:
  • 添加了数组边界检查
  • 改进了指针使用的安全性
  • 加强了输入参数的验证

这些改进使代码更加健壮、安全和高效,同时提高了可维护性。特别是日志输出的统一和错误处理的改进,将有助于调试和问题定位。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants