Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3B4E2C00140 for ; Mon, 8 Aug 2022 07:59:31 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 80712849CC; Mon, 8 Aug 2022 09:59:29 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="F5DWRrPe"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C05F9849D0; Mon, 8 Aug 2022 09:59:27 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2BA578486A for ; Mon, 8 Aug 2022 09:59:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=michal.simek@amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b+3P7Q6GT1iNTry1SJp/rv31AW6Wo8GX9CmywuKZqbd61VxAKT3wETtxcc0DLMW3kpbH/UKpOkzaCP0UC+sHRRP3WizPkSJYI/CTntM9ne7iLlYZNdQYiGqaswr5/kX9I14UG47vH6kO94E1l2SZj0cMXa+ZsYs/b9i/FeZ8/15NeIrsH+urC2W9fIfq53A+mVW3Ift+KauiNue2OLv9xW5ua4KtnXoE3yt4EmShfZQIxSQHgZznXHTQjUmsviopm6IeMffY9uN3OYmHILaGR0ICK92QWW5/kSFG/xg81nkcsxbUf1icV5FtqSjCEJOzRvI/7Mv31AMVkRsQcYT6+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tTX4QxO2aMNOnIRTkr8wZiS6A6Kjv3q/qv3/pWdGnl0=; b=fwIMgMSyhtuQYZ7SfkeZiXnMYlObeyofb1ElyfLezIYHOHUe8Vo/4m7ux2M7DAqKAWTUu1Y2rD0WLuf3rgXZaqB9/sl5XGtr4GBUcsFaEJPraKK8eZVQn3YxA1ZKcC3H56291ZqPgVUP9/S/KOvDMY7SvXdxke4DESb5b03Crv55iLl9YCN+531DrGAlwdjSv19t7Uy40V7qZQUjU3ASjrtx+azJf6lxQSVtmC4d8lzKXZqp8P93pO23m7G6bQBOJrG4C3yppaOLCE5a+b2XRiYhF6QgM6OL88QcnEL+8kTd0+ekORLvwQmnjNfkrz7b4Bws5MVENgvYnc8ghpxGRA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gmail.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tTX4QxO2aMNOnIRTkr8wZiS6A6Kjv3q/qv3/pWdGnl0=; b=F5DWRrPejkWbxDq0zj2XRnNiuPBfHFjscbdsj2hQgYu83mUuqmzFijOsI1qGugs7/s4h895vE91d7lDjsYm/AM231pN1F/CXVzlu6ip27W8clNQgZ8htMJ6xz+EJi3NTC1LAIGyJ9791yopMiWLfuRYfvxnFYXP9bAqZNQ0nhQM= Received: from BN8PR15CA0036.namprd15.prod.outlook.com (2603:10b6:408:c0::49) by BN9PR12MB5291.namprd12.prod.outlook.com (2603:10b6:408:104::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.15; Mon, 8 Aug 2022 07:59:22 +0000 Received: from BN8NAM11FT055.eop-nam11.prod.protection.outlook.com (2603:10b6:408:c0:cafe::38) by BN8PR15CA0036.outlook.office365.com (2603:10b6:408:c0::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.16 via Frontend Transport; Mon, 8 Aug 2022 07:59:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT055.mail.protection.outlook.com (10.13.177.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5504.14 via Frontend Transport; Mon, 8 Aug 2022 07:59:22 +0000 Received: from [10.254.241.52] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Mon, 8 Aug 2022 02:59:12 -0500 Message-ID: <350f31ad-819d-9024-c49a-e0f10ddd9f3a@amd.com> Date: Mon, 8 Aug 2022 09:58:21 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH] net: emaclite: Avoid reading negative bytes Content-Language: en-US To: Ramon Fried , Liao Junxuan , Michal Simek CC: U-Boot Mailing List References: <20220719084735.446539-1-mikeljx@126.com> From: Michal Simek In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 46241247-8cc0-4d26-ccb1-08da7913e7b0 X-MS-TrafficTypeDiagnostic: BN9PR12MB5291:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZwOeip2KSD4gTaA3TufqQRjUPlDZ0CdWvcIpB2GXny3Uvwanf12MTnZgcMsv/zQXtUNDbkrEuQ63G2G+EHRvWYC28OYEOW4QSu7ACXnUpyVjxz798Xf6RATgUofQni9g8vS1qiyodeCLVQH+pbACry4UBwieTCAuS5j6zTEAu8iuVC094X94SjWMKZGloXK6eV2VatTtQ2IeCbme71Uk3CG5ahB8KrmKqzgei3+CH/s8Emdu7US6H5a4+s/FfsGpVV4Q6pfKhYqTlrWqWqkIcVPa3laC9Z+nkdCh9ectVtEh4xmJcmwwj82SBXgh36/AtNNjXMaqpF34s4z1t7Xe9CqMxw9dA5MYUubdFuOJFXUrKusuH8VXpENVslZ+8JAoKZ27+19xStHTkSJzhAj8TwpeLSQSgNIOz5ulWDOGI7mkWWnAM4Qk3FlufkAPeiGzwWHVNJWmuZcOWSzT+tZ7T3fNzxrnYqAWqqz54u2TEj0tJK/VdDc9N51WLpoVQMgazoH9FAY0EB68CsRJuvhFx4or6TQawJSwpCLjXhNEVQpy1lPRUOU7TpKZPPH4HhPmamno61aGpOF8eJHo0wPihPTzyPkSX6LfQUtNJYtr7SGXmfGKwoUkKQgB3sCMtReoh5IQ6TMbdBfAjFsyKx5rB9t59MwCJMpv1YQCDRXIR2nT4BWsvh++jMtiW+84GaXia6nTe/ovm72mRvINKTPqaqdIUcYxD+D6BehI+CeC08XNjTKqvqs2O1bAHNyk2sV2D9uh95jJ6Kjm96d+J7An1BXbceMydvEfoiS1ggUXfrn8t2Vc6d5EsTddUJnkIMjz8Y4GoF0FIZlCRU6VYTTwJ/Q08rV7+GSFPK8Y/dVMnnTLWKAuZJDkAdgT788wKWcoskJekcYySd89XAkK4DKXLfypm5skjzfzEjvE2gBCJZ4= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230016)(4636009)(396003)(346002)(376002)(39860400002)(136003)(36840700001)(46966006)(40470700004)(41300700001)(31696002)(26005)(86362001)(6666004)(53546011)(81166007)(82740400003)(356005)(40460700003)(83380400001)(8676002)(2616005)(186003)(47076005)(426003)(336012)(16526019)(36860700001)(4326008)(70586007)(82310400005)(70206006)(36756003)(44832011)(2906002)(5660300002)(8936002)(31686004)(966005)(478600001)(40480700001)(16576012)(316002)(110136005)(525324003)(36900700001)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2022 07:59:22.4028 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 46241247-8cc0-4d26-ccb1-08da7913e7b0 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT055.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5291 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean On 8/6/22 19:41, Ramon Fried wrote: > CAUTION: This message has originated from an External Source. Please use proper judgment and caution when opening attachments, clicking links, or responding to this email. > > > On Tue, Jul 19, 2022 at 6:30 PM Liao Junxuan wrote: >> >> As far as I know, an IP packet isn't necessarily shorter than an ARP >> packet, and if length < first_read, xemaclite_alignedread() goes into >> an infinite loop. >> --- >> drivers/net/xilinx_emaclite.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c >> index 43fc36dc..134973a5 100644 >> --- a/drivers/net/xilinx_emaclite.c >> +++ b/drivers/net/xilinx_emaclite.c >> @@ -526,7 +526,7 @@ try_again: >> } >> >> /* Read the rest of the packet which is longer then first read */ >> - if (length != first_read) >> + if (length > first_read) >> xemaclite_alignedread(addr + first_read, >> etherrxbuff + first_read, >> length - first_read); >> -- >> 2.37.1 >> > There's a similar patch here. > https://lists.denx.de/pipermail/u-boot/2022-July/488770.html > I let michal review it. You need to CC me on these patches to see them. The patch from Samuel is better and already reviewed it. Thanks, Michal