Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp2785220rdd; Sat, 13 Jan 2024 01:43:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IG2YuhD0F4dG5n+xd8ZtDyAuEUTKGQ2KqRH1ur5lM9o7sIrWjmcfhZk0DQK6AL5gYal5BZb X-Received: by 2002:a17:906:7145:b0:a2c:4e5c:8b94 with SMTP id z5-20020a170906714500b00a2c4e5c8b94mr1344139ejj.56.1705139009485; Sat, 13 Jan 2024 01:43:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705139009; cv=none; d=google.com; s=arc-20160816; b=F96jLf77eu6UYdzImVZ4wKfRn+xoxDIQEQeOYemeBtpILr0Nh6Mzh73ruwbeHet+Q8 xq+48gJ1YWLJst3Bf8+WydzyzKcFdrLglw0q5AXm89eo7rURVMyBnUHkFEz7p0oaSdsU bZKT+9yHW9N5ia+O6XOjmMLZSmDZg8VeMX5lI/YeJbpilA/gBnRfb2M4Nk3HMUR0SStk iNy41qBxIMbij/G7NLQhnHHDkQ0cmTlIknYFabZcmwtz1LI+Rlp/e8q6Zi2ACQKMSxbG bR1NcGWA50tyACpGeM95WF6xfo0eEiX3g7EwNFqUTkOG5BrGIS0GY3CANOobjhkef6UH nX6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=j+gKJUMcddrDxDblWa+JTUjKRCeMM5aExrMLuiVy+xE=; fh=cBs7K3G7Vx4gstll62URxgDE6EymGldhbHKxNv5dxz4=; b=xI18xp5Bvfu6e9mGKOa9HmR88pAlTZJGG0TUM4e6bu+hxADX4Jo+W07k8jcCIrfzt2 QoSpEBNed4OuMuVHk0BSaoLxbz1ps6tgoY9U9KSAUMkZrRG0ot0cnhHRlIMrnv/g6QuL hNLbE26WwIS0Wx50oRTWhpJ2L4XqkF7Usr1M1pzfcO/YUdPUjWPwQA3bzWjWgOr9IzJR +tdQt89BiovnUMBTNKBvMv5/tAC9ZY+8/EuYB75A7McbupI94Zh0nsqB1zGfRamITc1C AgaPSI+dIZSpm4g73ab9GNDRdZUqmJ/duulC/Y82DZGhOowhE4oIXpJCSP91Yl9EvHn7 a3qQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-25240-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25240-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id oy4-20020a170907104400b00a2c174b283bsi2089028ejb.406.2024.01.13.01.43.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jan 2024 01:43:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-25240-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-25240-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25240-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3E41C1F22A90 for ; Sat, 13 Jan 2024 09:43:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CA8C41848; Sat, 13 Jan 2024 09:43:18 +0000 (UTC) Received: from mx01.omp.ru (mx01.omp.ru [90.154.21.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0646715AF; Sat, 13 Jan 2024 09:43:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=omp.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=omp.ru Received: from [192.168.1.105] (31.173.83.83) by msexch01.omp.ru (10.188.4.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1258.12; Sat, 13 Jan 2024 12:43:04 +0300 Subject: Re: [PATCH] net: ravb: Fix dma_addr_t truncation in error case To: Nikita Yushchenko , "David S. Miller" , Jakub Kicinski , Paolo Abeni CC: Claudiu Beznea , Yoshihiro Shimoda , Wolfram Sang , =?UTF-8?Q?Uwe_Kleine-K=c3=b6nig?= , , , References: <20240113042221.480650-1-nikita.yoush@cogentembedded.com> From: Sergey Shtylyov Organization: Open Mobile Platform Message-ID: Date: Sat, 13 Jan 2024 12:43:03 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20240113042221.480650-1-nikita.yoush@cogentembedded.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: msexch01.omp.ru (10.188.4.12) To msexch01.omp.ru (10.188.4.12) X-KSE-ServerInfo: msexch01.omp.ru, 9 X-KSE-AntiSpam-Interceptor-Info: scan successful X-KSE-AntiSpam-Version: 6.1.0, Database issued on: 01/13/2024 09:25:44 X-KSE-AntiSpam-Status: KAS_STATUS_NOT_DETECTED X-KSE-AntiSpam-Method: none X-KSE-AntiSpam-Rate: 59 X-KSE-AntiSpam-Info: Lua profiles 182619 [Jan 13 2024] X-KSE-AntiSpam-Info: Version: 6.1.0.3 X-KSE-AntiSpam-Info: Envelope from: s.shtylyov@omp.ru X-KSE-AntiSpam-Info: LuaCore: 7 0.3.7 6d6bf5bd8eea7373134f756a2fd73e9456bb7d1a X-KSE-AntiSpam-Info: {rep_avail} X-KSE-AntiSpam-Info: {Tracking_from_domain_doesnt_match_to} X-KSE-AntiSpam-Info: {relay has no DNS name} X-KSE-AntiSpam-Info: {SMTP from is not routable} X-KSE-AntiSpam-Info: {Found in DNSBL: 31.173.83.83 in (user) b.barracudacentral.org} X-KSE-AntiSpam-Info: omp.ru:7.1.1;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;127.0.0.199:7.1.2 X-KSE-AntiSpam-Info: ApMailHostAddress: 31.173.83.83 X-KSE-AntiSpam-Info: {DNS response errors} X-KSE-AntiSpam-Info: Rate: 59 X-KSE-AntiSpam-Info: Status: not_detected X-KSE-AntiSpam-Info: Method: none X-KSE-AntiSpam-Info: Auth:dmarc=temperror header.from=omp.ru;spf=temperror smtp.mailfrom=omp.ru;dkim=none X-KSE-Antiphishing-Info: Clean X-KSE-Antiphishing-ScanningType: Heuristic X-KSE-Antiphishing-Method: None X-KSE-Antiphishing-Bases: 01/13/2024 09:30:00 X-KSE-Antivirus-Interceptor-Info: scan successful X-KSE-Antivirus-Info: Clean, bases: 1/13/2024 6:00:00 AM X-KSE-Attachment-Filter-Triggered-Rules: Clean X-KSE-Attachment-Filter-Triggered-Filters: Clean X-KSE-BulkMessagesFiltering-Scan-Result: InTheLimit On 1/13/24 7:22 AM, Nikita Yushchenko wrote: > In ravb_start_xmit(), ravb driver uses u32 variable to store result of > dma_map_single() call. Since ravb hardware has 32-bit address fields in > descriptors, this works properly when mapping is successful - it is > platform's job to provide mapping addresses that fit into hardware > limitations. > > However, in failure case dma_map_single() returns DMA_MAPPING_ERROR > constant that is 64-bit when dma_addr_t is 64-bit. Storing this constant > in u32 leads to truncation, and further call to dma_mapping_error() > fails to notice the error. > > Fix that by storing result of dma_map_single() in a dma_addr_t > variable. > > Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper") > Signed-off-by: Nikita Yushchenko Reviewed-by: Sergey Shtylyov [...] MBR, Sergey