Conversation
1. Root cause: isValidLogicalName() used contains("p2p") to
filter P2P wireless interfaces, which incorrectly matched
arm64 PCI domain-encoded interface names like enP2p1s0u2
2. Solution: change contains() to startsWith() so only interface
names starting with "p2p" (e.g. p2p0, p2p1) are filtered
3. Impact: arm64 USB netcards with PCI domain=2 no longer get
falsely filtered out from the network adapter list
fix: 修正 isValidLogicalName 中 p2p 过滤逻辑
1. 根因:isValidLogicalName() 使用 contains("p2p") 过滤 P2P
无线接口,导致 arm64 平台 PCI domain 编码的接口名(如
enP2p1s0u2)被误过滤
2. 解决方案:将 contains() 改为 startsWith(),仅过滤以
"p2p" 开头的接口名(如 p2p0、p2p1)
3. 影响:arm64 平台 PCI domain=2 的 USB 网卡不再被误过滤,
可正确显示在网络适配器列表中
PMS: 239527
There was a problem hiding this comment.
Sorry @pengfeixx, you've used your own review budget of 250,000 diff characters for the last 7 days.
You can request another review in 5 days and 10 hours by commenting @sourcery-ai review. Upgrade to get a review now.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: pengfeixx The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideUpdates logical-name validation to filter only interfaces whose names start with “p2p”, preserving P2P filtering while allowing arm64 PCI domain-encoded USB network interfaces to appear in the adapter list. Flow diagram for logical network interface validationflowchart TD
A["Network interface logical name"] --> B{"isValidLogicalName"}
B --> C{"Starts with p2p?"}
C -->|Yes| D["Reject P2P interface"]
C -->|No| E{"Name is empty?"}
E -->|Yes| F["Reject interface"]
E -->|No| G["Accept for adapter list"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto reviewAI 代码审查报告
总体评价
漏洞统计
漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个 四维度评分维度1:语法逻辑(25/25分)✓
分析:
无问题 维度2:代码质量(23/25分)✓
分析:
问题列表:
改进建议: // 校验网络接口逻辑名是否有效
// 过滤规则:排除以 "p2p" 开头的 P2P 无线接口和空字符串,
// 并验证接口在 /sys/class/net/ 下存在
bool isValidLogicalName(const QString& logicalName)
{
if (logicalName.startsWith("p2p", Qt::CaseInsensitive) || logicalName.isEmpty())
return false;
// ...
}维度3:代码性能(20/20分)✓
分析:
无问题 维度4:代码安全(30/30分)✓
分析:
安全漏洞清单: 无 代码变更详情文件: bool isValidLogicalName(const QString& logicalName)
{
- if (logicalName.contains("p2p", Qt::CaseInsensitive) || logicalName.isEmpty())
+ if (logicalName.startsWith("p2p", Qt::CaseInsensitive) || logicalName.isEmpty())
return false;
QString addressFilePath = "/sys/class/net/" + logicalName;变更说明:
审查结论本次代码变更是一个精准、最小化的 Bug 修复,符合 commit message 中描述的修复目的。将 |
Root Cause Analysis
isValidLogicalName()inDeviceGenerator.cppusedcontains("p2p")to filter P2P wireless interfaces. On arm64 platforms, PCI domain-encoded interface names likeenP2p1s0u2falsely match this filter, causing USB netcards to be excluded from the network adapter list.Fix
Changed
contains("p2p")tostartsWith("p2p")so only interface names starting withp2p(e.g.,p2p0,p2p1) are filtered. This preserves the original filtering intent while eliminating false matches on arm64 PCI domain-encoded names.Change Safety Assessment
Code Safety
contains("p2p")→startsWith("p2p")change is a minimal, targeted fix. P2P interface names always start withp2p, sostartsWithfully covers the original filtering intent.Business Impact
Verification Suggestion
p2p0) are still filtered outenP2p1s0u2) are no longer filtered out根因分析
DeviceGenerator.cpp中isValidLogicalName()使用contains("p2p")过滤 P2P 无线接口。在 arm64 平台上,PCI domain 编码的接口名(如enP2p1s0u2)会误命中此过滤,导致 USB 网卡被排除在网络适配器列表外。修复方案
将
contains("p2p")改为startsWith("p2p"),仅过滤以p2p开头的接口名(如p2p0、p2p1),保留原有过滤意图,消除 arm64 平台误过滤问题。改动安全评估
代码安全
contains("p2p")→startsWith("p2p")是最小化定向修复,P2P 接口名均以p2p开头,startsWith完全覆盖原有过滤意图业务影响范围
验证建议
p2p0)仍被正确过滤enP2p1s0u2)不再被误过滤PMS: 239527
Summary by Sourcery
Bug Fixes: