From patchwork Sat Jul 3 09:44:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 12356941 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F41DDC07E97 for ; Sat, 3 Jul 2021 09:44:47 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AD417613CF for ; Sat, 3 Jul 2021 09:44:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AD417613CF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 855196E1B4; Sat, 3 Jul 2021 09:44:45 +0000 (UTC) Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by gabe.freedesktop.org (Postfix) with ESMTPS id C79276E08C; Sat, 3 Jul 2021 09:44:43 +0000 (UTC) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1639adLD018131; Sat, 3 Jul 2021 09:44:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : content-type : mime-version; s=corp-2020-01-29; bh=svZlTCB6B20wEoWmQ58bWpl6/UGX5R4GSS6cdLUBd74=; b=BIrx8SWq0mZi1soB5N4PHXfkC4Xsvvg2gwD84Ih3JDyGLFd/ALNRjaKbP1XSktHb/bH1 kMeNao2tdWyg858GWb4AVCGi3zhv+5/p6H2ANbulkCbCyRaVXVoyrycPSCrkzoQud6vX gxX6kprrt3zeNUKQUbE6RILej2kYCPl6e0xt3jXoCyxP6oOMKZ5IQEMIswInd+CTdmdo QaoXMCYZxez/xwq7TJ1CW9oo/E/B28tiTyfO+djcHGom/Q2ZtJeGRINk3THQKGHARDzb m9DFSqGFyz2cnR6QlwNbyZgRI3RAuhArPkShtLw7q5wnX34B/qUuPfplNC47pGLqEJne mw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 39jfsc887n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 03 Jul 2021 09:44:39 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 1639a4CH026862; Sat, 3 Jul 2021 09:44:38 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam08lp2040.outbound.protection.outlook.com [104.47.73.40]) by aserp3020.oracle.com with ESMTP id 39jfq2vtvy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 03 Jul 2021 09:44:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RBtH3EWqdBXOkXi0i35Xrwf06OOmmxmLeWHXaV52YepenPPCTUhRXedXN9c1+SFnrY8rdJIXYAn++oALlXQGC8Ze69rmjhS1cRM9EkAqLhH0tLueEtGWPKNkls5eyWKm+0ut3O1/S484ghYwE1YthxRccwhhsLcuBZV2mK8xGxsXa4wbveZAa508UcM/lYONqryqyStv8ojjV9b77kJ3HzPzxn9fKF0/ijVkqBqiCEl8VU87TZ6489IT6XkxDV7ci8KjbKtMbDEOSaGocoExXcICrD8O3no1zN3hAANJos1hO3M0hAMliWUN/PDvai4QIRKIPRxYlLXHxb/HVBc6gA== 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-SenderADCheck; bh=svZlTCB6B20wEoWmQ58bWpl6/UGX5R4GSS6cdLUBd74=; b=ga6XaX4x5a3Npe27HhzDU0ZRInz0KtOlEfAapIOiRLD//Il1vSb5QIU4+JZ1c+kdpt/OUvgXPwGKVc3hcWvpQOCmkHacuUNeO/EbVyMJ8bTfA1iDWJdr0/lv8O6VRuNreyUQcQdv0ptp2qExhP31o8HujCtqcS5Y4wl71JO6xhO37GDIDqvDQgsg5+aF5PB606rVxr8xCEhMz058oFrIGlhPJgcgIEB4ugL4Rw3htSoTHJhVFQ1YgZJI9BelLSe39v4kVgtd0IMVO3Q/0IFP5hNDgRUBhlcREEYbnZyE/7moIA3qfjEIRpI9ugJzhylY3nezHZwpbXRUdqHB7FHFvA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=svZlTCB6B20wEoWmQ58bWpl6/UGX5R4GSS6cdLUBd74=; b=PtnnvqTrQVD2GpC16IycF2Qcfe4NtUDCie3JaKcFJ+T+4bzg/tjJjMBQlzqe7F4DhNqB8SUykT4IgXEicNvXxi8O0WgVrjwxidZO7ZtbvM6uUigXnS/Qz1IoUOAEalx49udI6h/dUQoNC5uiBnOe4tMc1XFg1Z6nBiVHrHkfq3w= Authentication-Results: amd.com; dkim=none (message not signed) header.d=none;amd.com; dmarc=none action=none header.from=oracle.com; Received: from MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) by MWHPR10MB1616.namprd10.prod.outlook.com (2603:10b6:301:9::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.23; Sat, 3 Jul 2021 09:44:35 +0000 Received: from MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::3413:3c61:5067:ba73]) by MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::3413:3c61:5067:ba73%5]) with mapi id 15.20.4287.030; Sat, 3 Jul 2021 09:44:35 +0000 Date: Sat, 3 Jul 2021 12:44:12 +0300 From: Dan Carpenter To: Alex Deucher , Luben Tuikov Subject: [PATCH 1/4] drm/amdgpu: fix a signedness bug in __verify_ras_table_checksum() Message-ID: Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-Originating-IP: [102.222.70.252] X-ClientProxiedBy: JNAP275CA0033.ZAFP275.PROD.OUTLOOK.COM (2603:1086:0:4d::14) To MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mwanda (102.222.70.252) by JNAP275CA0033.ZAFP275.PROD.OUTLOOK.COM (2603:1086:0:4d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.21 via Frontend Transport; Sat, 3 Jul 2021 09:44:26 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dfddde09-d3fe-48a8-f2d0-08d93e072a6c X-MS-TrafficTypeDiagnostic: MWHPR10MB1616: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XLvLvzG4YTOOLDR80aMuYpv2Gxrp52ApwZCxRUEv/nkcmqTnAx42XA2MIZPu4326pjgl+Lo7vvsmaKjBT4beKLQ6ASx0NcQPWs8h11pxRKALNQ+8RP/u/6hQbk+0z/Z7e67MD+5Wkr58gRRS3eoQ1L2KKI2PTVykUxhZSSyT3r0dG2dJGgnpryBBL3UbQMlclKZnqtAM8XLRVZMhD2II+WR0QNzuqogKjH9uC87zJUTcOFWKKNKPufJEmYgOs864temqQ1NV72Hc3xTTEjeOq6FhfIkzA+kx1bUL2rv9XulNhg22hWh2D3zX8w9Qb9mvNDzxkqKC9Dbh58X+jOI1otkJ0Xp0phD3hihqequcd1vcDLINKsOl/ayGnla8o1gpXE2GSs1GcRxWhnz9Ai42oG0bXAAl8Nqkbz+OJiu9xzLj3w2mJnnWungmejr7fEQL54RpD/JaTH06X+f0195H7tCHT4PmZvnSPVcpcIiYV/WGyAK7nTz/f5B8zEAc68nlf+F7IUFKdF5YAOToEmJIMIEA335OHEFyDUo2JfEzlm3OZ2ICLEqf1xRB17lFhv3qVcEaDSf8LWsP5Qd6EDtIHXSs3ImlP5WXLoILn0ojCz62xz90NyWDZoAn8oK9OAv7UvjGtun3RGPLgU7mvznnIiRcoVbkHfgs84VnleEj4D36tmi0IQz9JdypVXQWpBp8 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2365.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(376002)(346002)(396003)(366004)(39860400002)(136003)(52116002)(6496006)(66556008)(66476007)(8676002)(2906002)(6666004)(33716001)(38350700002)(4326008)(7416002)(66946007)(38100700002)(44832011)(26005)(83380400001)(316002)(86362001)(110136005)(5660300002)(9576002)(54906003)(956004)(478600001)(186003)(55016002)(8936002)(9686003)(16526019); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1+h5mmM3Y6ZHtC/kAPwWkIqWTqXIq6AY6XtnBb+Nx/cBpuCyNxMT1RBw26+I2jvfQkfDATW6yWT/oLr7IBYZIfCRcIGT/J2cVEoWkFf6Z/fLEPPU/bhdnkDNr2r550gMQjvC1n/Oz6rvPsoYxu6XsiVS3yaKUu0iskz0RSRUu9jM0TFzeRN5uicLkH4oONv0UJpoO97PL8lWSuzp/rztGKUYCzFoUQiyUF5hxLjYWbuzt4Z9RlIU0/45xizhMt1i+H3uPT82UvnGv2V0IDYZnLICu6ct9tjeia6COgHASQ+slLH4FU40Cm3akyP0bhfudZFLtEDPvQf4EnLioEI/Sleq9IYJTqCXJTxEcSN58uf0S1RDKYmz98j0NnupJMygefhwto8Yleg5CnnqcYExtaI6rziSrn7AXVIiy48GxdNhZRo4ZzGnchseqjwI/keSeRTLBaLwVMDwBTCYErA2Fg1Cu5gJl5W5Kk64GbHQI3exFuFF/6DNPpjoQAGVlcn3Zn9rgHtqQy7MZPGaR5mJb+iFYqf3XcVqBL4sBkaX+KDL66ix+XPUYPQDu8h+RkpWPVPy3UOxNxYNMbARJ6M7PNAgOONNVwwL9Qio1mGhPA7mgIcP3WSu63ZAZGdarFkSnPlKuRv0yhMuQ1yX6VrQtRbXkRvi+nrgBt8K5Cbz/Yd15yY1xmK3838cBMnOHutDQqRfl5KfAHDF3OYrAjKsBQ3JtyUn5IyTb+ljdg+tQhCLHXpY+oGSsoXQxjx0tPQBdFaI5rrqXuYUXwN2SwKJybGXHxP4KG785GX4zIYiTKpWCD60SSPMngvf2FOYtB6zBac/hqOV1HtLsXxdgdDj+cS/bkRwfQD1aEcwVe2B+cDx9ahRP6zFQwGWkJMJFL2E9RT1ts9cNrVDK4dquZosSV6DDW6x47l6KtQxNW0N4+bIPJpiBG4GNlHyMzm64Fp6Pf57akoKUggTyqpemAU/f3z8c2Wa8cZiBLtwHdzUgfIzfo9U0cZwTeQILw3nIs3N/U5WG44BKmg6hGWuV6aMexX6WrBd7OBQESXQhZ6V3ygrxASPjmXZH4XcBoq/FKIzGIap4xEdc0fEkRpl59YB7qhd7aSdz1/3Zr8jZv+3DCG99d24edDqGN1DyWc57asJnYLE+o2ijbRshSoucOwdXtwA53D5/8vlI43w6Bjv8PC9hUlGhu0f/dsL9DHm+EhF7/grg7R0UNlbDVnAIPoNvGJNN2zh23WAnhVXx8+slOOD/RbasHP/4rbBAFM4g2+HPISnMgQtOT0PbJMWTrG+hKC1pd68hZDr9HMPmXNvM0WFJXnumjsWKJgTOiOTOimb X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: dfddde09-d3fe-48a8-f2d0-08d93e072a6c X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2365.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jul 2021 09:44:35.1439 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: YIdKuTjpu4uyviGLQZZsKWSNdlUw3EOiT6kRLg+Pi8fwiKSUieF2+VML3xDXnlij5ht/jrzcmncQ1zYt4X604mO4HAgYeqtuzlu4KRs5Fz8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR10MB1616 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10033 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 phishscore=0 mlxscore=0 bulkscore=0 malwarescore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107030059 X-Proofpoint-GUID: lZuFU0xJVD_t-6CFspR3pJV8oqZKJx62 X-Proofpoint-ORIG-GUID: lZuFU0xJVD_t-6CFspR3pJV8oqZKJx62 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Guchun Chen , David Airlie , "Pan, Xinhui" , kernel-janitors@vger.kernel.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, John Clements , Christian =?iso-8859-1?q?K=F6nig?= , Dennis Li , Hawking Zhang Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" If amdgpu_eeprom_read() returns a negative error code then the error handling checks: if (res < buf_size) { The problem is that "buf_size" is a u32 so negative values are type promoted to a high positive values and the condition is false. Fix this by changing the type of "buf_size" to int. Fixes: 79beb6114014 ("drm/amdgpu: Optimize EEPROM RAS table I/O") Signed-off-by: Dan Carpenter Reviewed-by: Luben Tuikov --- It's hard for me to tell the exact upper bound that "buf_size" can be, but if it's over USHRT_MAX then we are well toasted. drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c index fc70620369e4..f07a456506ef 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c @@ -978,9 +978,8 @@ const struct file_operations amdgpu_ras_debugfs_eeprom_table_ops = { static int __verify_ras_table_checksum(struct amdgpu_ras_eeprom_control *control) { struct amdgpu_device *adev = to_amdgpu_device(control); - int res; + int buf_size, res; u8 csum, *buf, *pp; - u32 buf_size; buf_size = RAS_TABLE_HEADER_SIZE + control->ras_num_recs * RAS_TABLE_RECORD_SIZE; From patchwork Sat Jul 3 09:44:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 12356943 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83F7BC07E98 for ; Sat, 3 Jul 2021 09:45:31 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2FC1A61451 for ; Sat, 3 Jul 2021 09:45:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2FC1A61451 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B629A6E1E9; Sat, 3 Jul 2021 09:45:30 +0000 (UTC) Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by gabe.freedesktop.org (Postfix) with ESMTPS id 326CF6E1D3; Sat, 3 Jul 2021 09:45:29 +0000 (UTC) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1639ZTNm015885; Sat, 3 Jul 2021 09:45:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : content-type : in-reply-to : mime-version; s=corp-2020-01-29; bh=zLHEU8iuFjwsZ/vyp00w6X1Vn25YOzwVoW/n+bstQBU=; b=WHZuFKatAjsPXogHuVWiTx8ESLtYxCluE033CXOQlbQSYta66DKKzNl7/7rf1Lktq4nk 6oAEyE6bdTFs8oG/Uog/X7KP4t2xLk+CZ+6nx09/ncFxZkBPPHR3wyxj1np5e1yakzJf JiUiWsitm9jgtuNPGA4TO48+7l4Zh0EDTIiajR/OUpphkdYVzd470s6cwVSMUATzBPF9 Ig9fQYmOBQZFfKzawhoao9Du7JPVps2adyrSPmZGe0VRrCY4PNpCKirW/35uaBPJ45WE n6NSHVcBGCfWyJI3TbrPdUth7o41CxkK8iBf8le9/beENIf2iLoJRkBP8e1Gr6XcpaEk Jg== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by mx0b-00069f02.pphosted.com with ESMTP id 39jeacg9y4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 03 Jul 2021 09:45:25 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 1639aF2p189128; Sat, 3 Jul 2021 09:45:24 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam08lp2041.outbound.protection.outlook.com [104.47.73.41]) by aserp3030.oracle.com with ESMTP id 39jdxbg4u1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 03 Jul 2021 09:45:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=knJm7gn3HScOjC5E8meKRLfVYq9OF7qcr1LpkMJJ1rsEi1G8NCzTSerS5LBkIvQYtrDY0tPtFnXs1T2Xk4nvaAjtO2E6dj4v+zGldP3AhUKSbSIJz51cMBOt7hiPn2qWw0EFnF44e++mjHL9YQJOqEGOBP9hqiDlQ/IUEg4lDbhiRRQfnqAyYVHyTfn+31guhZgf01qIAC5dDOoJVwh9mKKf3CrynwqAg22eRjO3DYMgzm21QCQbOclnu71gaSjZEOZkyK//hRbxjfVNW0JiIB1PVlEA6CcpHHrrh8ypzPI2i+V4qi8yNJ7+/Z2mUX0TNHpG6o0guNBZou4bIUWqFw== 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-SenderADCheck; bh=zLHEU8iuFjwsZ/vyp00w6X1Vn25YOzwVoW/n+bstQBU=; b=fnCy/m27vpTvYAEx2E9wye2zYIf1M2OIYw5TW+hd4iaEQvAcLJV3YfTiWpkaQZWxGqkaxkeYOTgMYoUUmCS/BRjrJ0yE9U9f4kcvvcTy9EUI3ZmWdvynM6JXwUo3dXlsq72hNff3USCsPPlGtU9eoMYwQyM217EIEglhhH7j+trlbOFKunIHhw/0AB95SCuhvSW2deHFPZ9N4+9PjquBOfBfhxcFPCb95RlcRf9gbL2wkW1tzpo51Gqt6UB0XFOhL6PfUrsyjFc+vKFrwbMYIs7gOPYEUuD5Qr7/nxiMwOLVodKmCkBsrfW/rmElJuTT5kFs6Sh1bs7p0oCOdr3ZLQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zLHEU8iuFjwsZ/vyp00w6X1Vn25YOzwVoW/n+bstQBU=; b=EH6w1uX1eetC2XE/rTwbWnmuGOLUQ8Qb/EfVEfoJ9jtvcMpLYVPjQmMuwLh7zW0mFdfTtIOYgrOpSL6R8q2xtLYcHygMga6bFYfvOamMqmgozn1IR/HJSKZCcM8/aguZiqiCbOGcA/vxNF/kcMeGnhL6O7GghzvVMHj456CUavY= Authentication-Results: amd.com; dkim=none (message not signed) header.d=none;amd.com; dmarc=none action=none header.from=oracle.com; Received: from MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) by MWHPR10MB1616.namprd10.prod.outlook.com (2603:10b6:301:9::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.23; Sat, 3 Jul 2021 09:45:23 +0000 Received: from MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::3413:3c61:5067:ba73]) by MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::3413:3c61:5067:ba73%5]) with mapi id 15.20.4287.030; Sat, 3 Jul 2021 09:45:23 +0000 Date: Sat, 3 Jul 2021 12:44:57 +0300 From: Dan Carpenter To: Alex Deucher , Luben Tuikov Subject: [PATCH 2/4] drm/amdgpu: Fix signedness bug in __amdgpu_eeprom_xfer() Message-ID: Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email haha only kidding X-Originating-IP: [102.222.70.252] X-ClientProxiedBy: JNAP275CA0011.ZAFP275.PROD.OUTLOOK.COM (2603:1086:0:4c::16) To MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mwanda (102.222.70.252) by JNAP275CA0011.ZAFP275.PROD.OUTLOOK.COM (2603:1086:0:4c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.21 via Frontend Transport; Sat, 3 Jul 2021 09:45:12 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e40d6057-6c7e-47cc-18d6-08d93e07470a X-MS-TrafficTypeDiagnostic: MWHPR10MB1616: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1417; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BXU8Itkxhe+bYp4F01+hpJdrNSQ7sfds2zHly0amgFM7kizbsV8o7fAP38ldNnxxnH9JpW3eXKfRuPDLnT52he7Y0MwTmf+0y+daTgYws0pc8uH1t+OmvJOB6ylR78wOs/y3FYUVGiGKVk+TN1/9KVHQm/4l1rhdLBhZVbIg3gD6uLC/SMD0RVwvRNy3U+42h9UhqzKYE18NfVGGW23eqsvrvTzXtRkVtH+CZFVxkrAbnsZtJZsRDlH0CCyvaSjOR67kVEKhXZq8eGUhTWFW51V5VwAD4jm/wtNVYjOxyyTmjTUSw+ZwwX9rvDyJnRIy5BZjlXI6BKDKQJCuLN3swHNL7qRv4Ojnpr6OfNeVWdAXFXms2EBGk018oPpGJ3CS+qDcl7+k0wjmkbjFwaPxFVWeGQChStsP9zpMBtTwOBeti/nBlbNeLDDFH3LxLsquWeVPL4turZ2g9ZUfr1qE3205T8Ffiw1FWfi2TQHyXIGYfdS40Pe/StJLlDEMSTQ/d+gFFDIqdm6N+M19mfieouOb9VHsAgnb6yF/DPklp1BnTzuWbTMwXY2gP9qy4OPXicROYM6nivzLvd5YD98zzfgggE1zWmbQ7sYvv5aqsfsiU28AP+SDgfb8cPx17sUjlmR3LBX+GS9A9H/CiPxwvquaR0SQsMQw4+YbXULd6c8Dg/+bTioix89gTnVXXcbNb/x7QLwKF/6zw5GiphEoWw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2365.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(376002)(346002)(396003)(366004)(39860400002)(136003)(52116002)(6496006)(66556008)(66476007)(8676002)(2906002)(6666004)(33716001)(38350700002)(4326008)(7416002)(66946007)(38100700002)(44832011)(26005)(83380400001)(316002)(86362001)(110136005)(5660300002)(9576002)(54906003)(956004)(478600001)(186003)(55016002)(8936002)(9686003)(16526019); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4d5KcguEoHxuDpL4ccyktC+cLZ0GmYa5GrgOuucnb0DKBWYXOR/cDNMI8sGXk8Zy1thbFGSULxZit2GzgXi1FZEFMZobmX2/wJk2xttWK/R12tHZ/RJL2uf0yyOZZbXGMqOyl2jMJkqhhS8vm/YhDWUDxm+nAmBxJGzhUDKOBLiKKR9cSLPu6F15LE8nqlr+XuQUUmsdnEs/jcx5zv/IlQQPKHEnQjnie1abssNzAhKinH5tc4BgZ7UFgJRwlZK6vZ0Jvies6kadjb38+FGX/OLm2otW/bio7ObBTUZDtbAuIw/6ZSW/gTCkmcK/c02uiQtshBBHxcJ0an4xQLOuf5iPDvpvM1CedstiabL7++fiRyPtrKYlSGliCHxOyGK/4h/elyWwsrqVV5nSTh0snMbLnz1P1K0qDpCdX5kZJGssptlpeRJnBgGlbJXRezqixANPawZhLuC5l6Gy9zO0f9Hv85o8z6N16mwJh6i/AEX9DTiui4nBUE13f+xj+aiPs8pGVEypbXWam8sYq81EYbk1XRrNdR6P8zEZ6YiCMInmrNiS1k5qN8F9lQqM29kPm8RUDQTLsrmBLd3+fSMnNLJX8Q6rAAZ6S5u21db1OA5/z18N9FqhOsvXINH0ivsRbRaZN2j5cJDw7eV1YKgxnpPwoGjGx7jWxSpYumj1Ti67JpDNm/IXls0vGpxJZ0fta38jN5p6ewjnw3B4EtAecfUENFCUP1ooYgkl6szLNqOIocAqtUL2MxlqinUrd2dCVNNGYzktt7FBABsa9SHG/ki6V5YuL1NBCPsXF0r2XKKggKV2SnUw+s5OaqhPe21rnqLGT53iAy9n1REnJG/MfqzJXJCYXjULE6VuNInbU0zFP2LBcu8JDz8UgKxt9cDgQlJ9aWjqZ1SuVlugvQu0UoPJKRl4SANPRmRNoVYwTr7MHOR6jfq3D3fDWuz7AJ0SUWstAIOAKeZphD5CB4KlBIFTMw+eAT4+dOzyoJDUo2RyoMdPWp8fFxi8vRBFH5e5O+ZLhHPzV0IGVh/FpYzgSWMPzaTInJyocqqrhm12H+aSPkOtBkKmZ+0zEfjRuGl94EwuZq+IJ2Hvoe8g037SM+07PiVdVJjninrGnWirY47UCCdELQ6+EnxKG6lvwEfFZoS/xp6CJKYQJ7S0+71qS8VZBvorcUGw7VY2HeYzVLaAScZrlnxBh7UAKPaBust5cEn60z0ZFQChk7d9/0taY/XafyBWG+PmElLRQ5uiz8dSRry44AY8BCDNDP1etwe3EJDbQdISPhgOPXLWTAagVR/+q3PgL6tVhJkAeuspXcY2QZ5rEb49Vx23glH2WMV3 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e40d6057-6c7e-47cc-18d6-08d93e07470a X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2365.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jul 2021 09:45:22.8652 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: mCJIa/dJbQpOPOTHEKMKPrmGrCIaT90/voz7W6+AgGcs3joq74DibHPM0TXfafGI6Iurlr4jMPbJlp8gJBTfqcI19CgEALc8Dik2PMdhKBA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR10MB1616 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10033 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 spamscore=0 adultscore=0 malwarescore=0 mlxscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107030059 X-Proofpoint-GUID: xIAlsBPnwupXfzUu7RgVsHAMr4ekrWM3 X-Proofpoint-ORIG-GUID: xIAlsBPnwupXfzUu7RgVsHAMr4ekrWM3 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , "Pan, Xinhui" , kernel-janitors@vger.kernel.org, Roman Li , amd-gfx@lists.freedesktop.org, Christian =?iso-8859-1?q?K=F6nig?= , dri-devel@lists.freedesktop.org, Nicholas Kazlauskas , Bindu Ramamurthy Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The i2c_transfer() function returns negatives or else the number of messages transferred. This code does not work because ARRAY_SIZE() is type size_t and so that means negative values of "r" are type promoted to high positive values which are greater than the ARRAY_SIZE(). Fix this by changing the < to != which works regardless of type promotion. Fixes: 6cda0af81a50 ("drm/amdgpu: Fixes to the AMDGPU EEPROM driver") Signed-off-by: Dan Carpenter --- drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c index 4c3c65a5acae..4d9eb0137f8c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c @@ -147,7 +147,7 @@ static int __amdgpu_eeprom_xfer(struct i2c_adapter *i2c_adap, u32 eeprom_addr, /* This constitutes a START-STOP transaction. */ r = i2c_transfer(i2c_adap, msgs, ARRAY_SIZE(msgs)); - if (r < ARRAY_SIZE(msgs)) + if (r != ARRAY_SIZE(msgs)) break; if (!read) { From patchwork Sat Jul 3 09:45:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 12356945 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2EC66C07E9A for ; Sat, 3 Jul 2021 09:46:10 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EAE2061451 for ; Sat, 3 Jul 2021 09:46:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EAE2061451 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2EE976E1ED; Sat, 3 Jul 2021 09:46:09 +0000 (UTC) Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by gabe.freedesktop.org (Postfix) with ESMTPS id 68B006E1D8; Sat, 3 Jul 2021 09:46:08 +0000 (UTC) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1639a2UV016033; Sat, 3 Jul 2021 09:46:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : content-type : in-reply-to : mime-version; s=corp-2020-01-29; bh=GySA7FNOTDvnQjz+PZ0epQM1iUfrbgMtaraMa8L2cnk=; b=hqqOnRnSti5A3FEXPMfLEs+cYwGXdpMrAABBKV+DbfBrDn6ddDnt3rh3sBT3Fv20TQiO bdWXDe4y7Bw0flixsAw8fhjTicy6oyasWsWLGy1sSCXfkCbGR1lcnljG5MdeU8MRzBXI DCzCi1I5tTRwcdZ1nwY8j97+FKgK4ZLwOTD8mX5LC7Uv7+hc1G2mPJAbFNZgp4pN/mO7 Vr0riXcwpSSWSMX5RyLc9R84d+MEfE/OpHCaGrBsyCOk28UYnXvKzDUeAoeNHnFvtWrQ a5h6y1PXMr8QDBoY1GNt1gD9NTKDZhAyuxnx320/Xfx26Cq8HSoqqXJuB0PSpYjhsM8F vg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 39jeacg9yd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 03 Jul 2021 09:46:05 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 1639jp6w192840; Sat, 3 Jul 2021 09:46:04 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam08lp2049.outbound.protection.outlook.com [104.47.73.49]) by userp3030.oracle.com with ESMTP id 39jd0ucej6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 03 Jul 2021 09:46:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QkvMVmPhQWhGvZinQOd7E7CPkt/NV/v0nGNolxKL56J69q37UXBcc59SDWvkrHuBxW3JiqYdBFbUTT5Jbm6C3pwA2l06IbIt/7uLHgSUCMvYNLascFpuP28Hp2GIXSksYWOJOvxrallu+WAQwKjCkVv7ZQ9X0jXvidYiJ1kVcOP85gs7RlZ0jIG7W6CbRZoaSp9BxbeiOexvS3uI0WZTKZtemD/TyrbZqeHpLtgp9wIZgPWtFnRDU6JHqY4IK2+2lPfspF9XEfmB1XfGNUwyZV1A9DCv73gMfb0osEBfPBXzzu/AwoGQg3tPHcmkq37CaZc7WjYu1VVSnYnDU11UIA== 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-SenderADCheck; bh=GySA7FNOTDvnQjz+PZ0epQM1iUfrbgMtaraMa8L2cnk=; b=PTztnc0uZ1PSYlgZprXAUEJbXuIdtoCnvugopDfJIaddLZ4SStfu5SvhuamzdJjXZ/LJPS13tljuoEFISny+dWvzEthQFU/v0bQ84HhuYCMabz+1Nsz/JEaoqNKCDxoR8F/vsk4HXFopXtUtUzzDWUM4EZ2HZD9VhyLd8ujzwaL4hAJf3JboU2mrnQlQfVwB/vyua5URz5U6OELlTWD8Wbnctp4qpO7kXhVXFnVgVGA/GCbOrHo9lOxmOUe7JsN5sgaM/J6GFYX8CB2FKbDY2DV1VRVNpVKWcaq+2Ox0ySyO08pgBNETshrAX760R+EqQUtDm2cwstjvSwKugdsVlg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GySA7FNOTDvnQjz+PZ0epQM1iUfrbgMtaraMa8L2cnk=; b=PhPeEl6Cyx4qmGyP6pKA70DM3fMlD3gPCdPdLfb99XuRkaUBOFXJQuMuSDBAixm4um5EtvKn7VC8n9iasMvwQoGbr21lZ1nvv9ldbLK36c1Ui20fJ/AY4uuJPL93nEtixRampGO/HT3mNsEuWPTDCoZisHqziKMPxpfkDl6l/MQ= Authentication-Results: amd.com; dkim=none (message not signed) header.d=none;amd.com; dmarc=none action=none header.from=oracle.com; Received: from MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) by MWHPR10MB1616.namprd10.prod.outlook.com (2603:10b6:301:9::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.23; Sat, 3 Jul 2021 09:46:01 +0000 Received: from MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::3413:3c61:5067:ba73]) by MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::3413:3c61:5067:ba73%5]) with mapi id 15.20.4287.030; Sat, 3 Jul 2021 09:46:01 +0000 Date: Sat, 3 Jul 2021 12:45:39 +0300 From: Dan Carpenter To: Alex Deucher , Luben Tuikov Subject: [PATCH 3/4] drm/amdgpu: unlock on error in amdgpu_ras_debugfs_table_read() Message-ID: Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email haha only kidding X-Originating-IP: [102.222.70.252] X-ClientProxiedBy: JN2P275CA0046.ZAFP275.PROD.OUTLOOK.COM (2603:1086:0:2::34) To MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mwanda (102.222.70.252) by JN2P275CA0046.ZAFP275.PROD.OUTLOOK.COM (2603:1086:0:2::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.22 via Frontend Transport; Sat, 3 Jul 2021 09:45:53 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 517aacda-e833-4464-b7f2-08d93e075e11 X-MS-TrafficTypeDiagnostic: MWHPR10MB1616: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ymiKYccTJ/b3NvR9s9i8aFABF90yOxhTHtWBfoyGNQvpZ675HUGyCYDHs5j6DKfyh8fOBwekORUx++ZCI1FXiYtWIu/lTcBRcf5ZPRCNhFqCwvd1+YaBQM7Kkskgay2FiVmd11Z3wmeH5dyfiS8Y3KtJMcXw3qeq/P6yZXMElHVzEastEClDM/zOvH4tKerrCsSqKi73/dzSmGlX0TBupe6bZEF5GFRSGsGVZ1imVfaU8YceterB7F/KrRnTVrTxy4r+klV1KMzQNm9Uugxo10TF+Ciz6mKmt+HaSaEKGpBDDAS/pQdNFcn9fqf58pB48lOv4+pkDE1r4W4/F9ZIy9MmxjL29Fwey+An0+cQDY2itC4Ck5FEutnchasik0c1T2jVDOBjAhT7nF+az4Ww8b6whTfNbNOtyl/nWLnhum7wnBte6Rj795/P9zVBYFKQSGct0F6BcBmqhKk/x9435BHLJkN+GsEVMsbwT4rXbU4etNtzFLcHgMpMNnMfokDTz3hEyjqb25WBBd9Crujz7sMAjGq49IhY3tOXC7tjUdOf6k2khH5U6HN4kHjrT1crsx7dE0CePJKE75UoxLBnyiQbHAusPh9W4qsPMKrzqNQizomJJbZuEjJdx2iQf39eI2hjgLK23DoMwII7Zwkx2/7r9Gkkvmuqjlz9lltjDeNMZG13i3jtuUusEgKB0kctGSok9iG2PXROn9NEkcN8Yg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2365.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(376002)(346002)(396003)(366004)(39860400002)(136003)(52116002)(6496006)(66556008)(66476007)(8676002)(2906002)(6666004)(33716001)(38350700002)(4326008)(7416002)(66946007)(38100700002)(44832011)(26005)(83380400001)(316002)(86362001)(110136005)(5660300002)(9576002)(54906003)(956004)(478600001)(186003)(55016002)(8936002)(9686003)(16526019)(67856001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JVLo+shetTuMAWO1kzoVCBm6Q98S/gbs9oA1X6/deMFTcy6QF3n+2SlLXQoIvG3onHcdCH9fAPHAXw/5lKEYnyeEPTTN9QbhDj2OxJ0Okddupx0k1uSkXeUZUAfxw8qUk6KQCGCHJn1kmslYRY/Q/puDaDrtZ6CGIafsmbM3Kioca4DgMs9hTm6yTnedQHa22plf0P1CJrY88vs7vamq25tNPYZZyWAKXoautp+1Vx11tCI0a2b9brSpjL1LWfBJpwX+1y0/CnDXYXgkzY3iJVm/eHpk2YwBfKftpbRwjcaG8XGs5qNFOAzMDJM9SDsYZnNc5+8ctAiWqXSfHOvboUNWDQW4Xres5zMAEU3wO+TCRecy0RPU+ZFlB4nbM01l+y1lani06TJM4GRI/qmPMSPXUd+FYvM5o5RpiLgdixlT0Nd6WLjXTz1lC9vLLS86C7DuaGG3JSsoJ72iUfjfuOSYRQNaTHAQxwXsi3ZPB84nixX5EG9P42Elz2rXyx8yw45gEjmMEdhFhUt8taNb7ubDai7QI1XkVy7OlEj25fgmw0HuQCQ4k0S61N1l5yZQGp2b4c9PEGAEMwLnYXExiBXo6Kg9oo9v6wn3IYwH5dfgVcanGGtwyV7Z1iy0JFPJeNk7OEnD2sWQSZIWczdTq9n6JCZNsm2Hquz2x7cLamW0NxFyPrXj0kb3UGg0RByFB+U8+iZJrwiAndBTIlucTZ9dapza76r1952wRt8KV4PQvOJE7VEUw+Y5u5LqT8pk8sThFDjfM2pY1fFiaEQzg9aiYguBf2zoVKU1F7YwPiWvPrzkKUhFHZcBh6R22Yd1RrS/GerHfeL6Oqetc7mxC78bWf0YPYRqFVA9LbzJxSqcKQ4XBbGjWAWwhi3YDV5YXUnPWC5atWLWnfWGTlGf7bdgEN8wh+rIJJBnT8SpVySJjn1q5ihhiroM7iajlvVn1af1Dv66Y6T+Ucp2zOWYzgXQ5BS5IkG/1Cz9zvLrcPJD11Mo+G1vpMA4/sGckhi3I3WIeLO/7GSSyZQvGPFvRVze9jw6dNGXmhetY0vz+PrXEHIzdnOFTiv0m5KaqiWrypqGOFb6qO1if8jxFIEfFsZKpb0fA9aCMfcaITH6+0RKDXAAfuLLWlpDYSIUAJZKPvk8yx2BUCD4p/4FjfcHGBLKhCNPPHxIS7UVbhplPCCsLk7HZgIEAKp+Ps47Rida3Cv/VufUUYMx42KM7wjQVAVjXv4ha+lnofzwbLIkOHOj1I/ipbdp4041W9lIk5S+uJNJNHz6vyU0fyQkyuwq3vMFR8lrOhgsV0GXF84ttGSuU4MKA4M8zatql4CD6z8F X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 517aacda-e833-4464-b7f2-08d93e075e11 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2365.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jul 2021 09:46:01.8245 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: qIWyWYjXjJHxPugQ6qwHDOc7M8/LOGS2wzC4b7u4sUaISpNhPGCTuvdndb82Pn7La9n2SoOV64ZM0CLf+xQihYxlM57MPdI76AlWOwsMxKs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR10MB1616 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10033 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 spamscore=0 suspectscore=0 phishscore=0 mlxscore=0 bulkscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107030060 X-Proofpoint-GUID: Ox1U_b8krWplqGD46aSjwYgrNPLUBOcF X-Proofpoint-ORIG-GUID: Ox1U_b8krWplqGD46aSjwYgrNPLUBOcF X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Guchun Chen , David Airlie , "Pan, Xinhui" , kernel-janitors@vger.kernel.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, John Clements , Christian =?iso-8859-1?q?K=F6nig?= , Dennis Li , Hawking Zhang Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This error path needs to unlock before returning. While we're at it, the correct error code from copy_to_user() failure is -EFAULT, not -EINVAL. Fixes: 9b790694a031 (""drm/amdgpu: RAS EEPROM table is now in debugfs) Signed-off-by: Dan Carpenter --- drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c index f07a456506ef..3e33e85d8dbc 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c @@ -821,7 +821,7 @@ static ssize_t amdgpu_ras_debugfs_table_read(struct file *f, char __user *buf, struct amdgpu_ras *ras = amdgpu_ras_get_context(adev); struct amdgpu_ras_eeprom_control *control = &ras->eeprom_control; const size_t orig_size = size; - int res = -EINVAL; + int res = -EFAULT; size_t data_len; mutex_lock(&control->ras_tbl_mutex); @@ -912,8 +912,10 @@ static ssize_t amdgpu_ras_debugfs_table_read(struct file *f, char __user *buf, record.retired_page); data_len = min_t(size_t, rec_hdr_fmt_size - r, size); - if (copy_to_user(buf, &data[r], data_len)) - return -EINVAL; + if (copy_to_user(buf, &data[r], data_len)) { + res = -EFAULT; + goto Out; + } buf += data_len; size -= data_len; *pos += data_len; From patchwork Sat Jul 3 09:46:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 12356947 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AAEFC07E98 for ; Sat, 3 Jul 2021 09:46:49 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1602961452 for ; Sat, 3 Jul 2021 09:46:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1602961452 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5462C6E1FB; Sat, 3 Jul 2021 09:46:48 +0000 (UTC) Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by gabe.freedesktop.org (Postfix) with ESMTPS id F2F376E1FB; Sat, 3 Jul 2021 09:46:46 +0000 (UTC) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1639k0s2010419; Sat, 3 Jul 2021 09:46:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : content-type : in-reply-to : mime-version; s=corp-2020-01-29; bh=Gx7xi/V9Mp2S1H2kNr+ypHdVbT/GPk6E6g2Azz/+3fY=; b=W8Km8kAJPwO7XOewqrtmFYLvXyAAgVxvWnZLgPCdoJGkng9pL8N7DAhOW1AmuvuPO41z GasHLd4o94M5Z4xeCJsvoXU9FYFQfaYM0sBDgtE+AgkWYHUC03nX4TRKqSWKwgvc6M+H DFjRs7PhdIjGJ1FI1Mr9r8sM0KSzhGaaqOprBbQrsXWV/2DFjiI4jFvDyLZvHoC2Fz6i 5OFf2lWVEnnS4hS3zOmtW+7x2q2Bf3DyrdWmBBeOPSD5FXpW+PkUmyrVAHt+YB8+y6ba 72bmUaRe35Xs1GDdcvdxizTDiONGqU3VMsUpI99E+q9fHFa+SXkDDwTWZjiOhivifMRH ZQ== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 39jep1g9hn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 03 Jul 2021 09:46:44 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 1639kFZ9097512; Sat, 3 Jul 2021 09:46:43 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2168.outbound.protection.outlook.com [104.47.59.168]) by userp3020.oracle.com with ESMTP id 39jf7kepx2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 03 Jul 2021 09:46:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ifQeVoEMz0ND5ta/KoDD8BrHEixYD8N5aQPBfKpoBsbiFPEC7j9Ld5qmZG/PV9v0Fd/ZjmxnFcdtpcfKGBp3z8fATViH8QkIhxY3SNdkUqfPTnLXkAEUCJqo+eTdu0rmINCWuSycDvqgSEA9PL7hpW8DdEfvda29hfMBPjyanZqJCtQVf49eHyaT2C32Iv1NnS4DtgZ4Z4HhvXXqOXPcRHstJo/0+qnZwkm8LEnS7oGjY1nBupx6COMtMFfs30fh7/E2ZdbPYdVa6PHNp0UTghU9RW6ZaYdpqaEYfSInGyGLwrjbQnVZF5BlaqZjRMixskdJBNQpYovwzytXvIx5DQ== 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-SenderADCheck; bh=Gx7xi/V9Mp2S1H2kNr+ypHdVbT/GPk6E6g2Azz/+3fY=; b=SNGLFI45MyWagIZaUFxWiJEBnZ5F8Cmyga5wI4DxFLbraN4qwFqqLWhmEmMtqERmgs9kksEsenJWM40bQ1rfbupmGtRKmuZ/wgNDujKdZsCvrHPVk0SBnOD1XS5fQjzUWMDxY5E3bNmWF8vBrZasc0P3gcAUcMonAYSBCNSr/lKVbqwj7JL2t8lHyzJqLa0+cLdJa8ngE2M1IcpEW4s2rrN1VfpqXUKQOlU+WUz3aQuBJBrw8eRVHB08XV8V6DYEuSErT5Ei3XpfMTz0RICpGkZN7HOTYvjlvE+/V7PIacG/JC2uoc3fAeDetI4oeC2N8i0wvn24fjWrhwy2xRnjrg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Gx7xi/V9Mp2S1H2kNr+ypHdVbT/GPk6E6g2Azz/+3fY=; b=kCp4oChpi1/6sHl2zGRcWLBIh7xp5pqpIWrI+AHVirkhgDaSC14z4Jz6Cd+SXdPBLqucYfbO5EPnKUuXU6q5BMLJ6PgpgiHiBqBfKLafzRUWz0/soLolNnNWIdySFDipQ78JsFY/1sj7pH7b2dUsEqmBs+NmfUt1QBlzViD9nb8= Authentication-Results: amd.com; dkim=none (message not signed) header.d=none;amd.com; dmarc=none action=none header.from=oracle.com; Received: from MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) by CO1PR10MB4628.namprd10.prod.outlook.com (2603:10b6:303:6c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.20; Sat, 3 Jul 2021 09:46:41 +0000 Received: from MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::3413:3c61:5067:ba73]) by MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::3413:3c61:5067:ba73%5]) with mapi id 15.20.4287.030; Sat, 3 Jul 2021 09:46:41 +0000 Date: Sat, 3 Jul 2021 12:46:20 +0300 From: Dan Carpenter To: Alex Deucher , Luben Tuikov Subject: [PATCH 4/4] drm/amdgpu: return -EFAULT if copy_to_user() fails Message-ID: Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email haha only kidding X-Originating-IP: [102.222.70.252] X-ClientProxiedBy: JNAP275CA0008.ZAFP275.PROD.OUTLOOK.COM (2603:1086:0:4c::13) To MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mwanda (102.222.70.252) by JNAP275CA0008.ZAFP275.PROD.OUTLOOK.COM (2603:1086:0:4c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.23 via Frontend Transport; Sat, 3 Jul 2021 09:46:32 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9e4a96b9-64ea-4606-57c8-08d93e07758a X-MS-TrafficTypeDiagnostic: CO1PR10MB4628: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2399; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0PSNDENdj5KlwSkkjZrteWJWE+Hg8cLPSUP7FJm8LrHULvs+kzjyTETxNixtD5iuoQCbPclHxjTGjneCaKvJ79bZawvkR927Fx6CtIaN4XIjCx/UgG11MSTT+Kt6EWLit1mS3Jxq3GcXZOhCAoe3Tcoas3TOyyCbhqv3YgX+5AjnrWcTM1EXD2YX0SYLIg09O+i0/u1sudWqmtoKYzFt7gSX7+wb96+6ap2jVUw3fG9r9QoCJruw5YYsBAZtFZAtMWfzxZRuKbv7tOEbc1fW3HPoC0U5bF+H6MfLvenbRIntNSq1OUh2QGdEsqoacGQrAP2o+bDX2OidaqLBcaV4duqiTjZZVnCfguA1JhKa3/feI6GpZTKsIMEb0k2WSPMUcTXYwEBYB699jZXqAyimFWfMo0FxscE/nLoOFRB+hPvx89J92Bj5v+hNnbnA5IMNCkrQTiRqB3W31NOLT3pt8/rOUBP9Jc4l2dEK8ivd9MWPnODVdl8GUUJHZ7N1xGXkNGrXqfYKrODCu+Jbgf3Uzbo1ME5gOQnFNwoASas7zvCP+KDzUyTnfQQNQYrYAEu2F07hAbdh0d2Lm7qct1ybShlf/3+hewbgfDpjvufH84wIWbscQAH1LYjlRWk1WnK5/r6w0tfg8eis+sal5XBypvQRZiZ+1GMN4q4jYZkbMO71+NCXgfXUlKzaqPjqRfGV X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2365.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(376002)(396003)(39860400002)(136003)(366004)(346002)(186003)(26005)(54906003)(316002)(16526019)(956004)(38350700002)(5660300002)(4326008)(38100700002)(66556008)(110136005)(52116002)(7416002)(478600001)(6666004)(6496006)(4744005)(2906002)(66476007)(44832011)(33716001)(9576002)(55016002)(83380400001)(8936002)(86362001)(66946007)(8676002)(9686003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Wg9hRYQiQUO/gTZLLWFENkATY7DJzZxKZRGoMRXt7DyMAvEqN0/vnF8Xo3DXRA2ZNenEtiVKy7HGK8fHJv/ELBbXiJHc4CFFql6ev86Zbj+boQtlmeswEGMR2eR793l4LCHXN9PPbheGwmRHHW/fid1reO7LiXVOkQVQJ0X7Og+DtMCoEmJBcGTtkpfvfloz5gQXjyILVPz6PkXokbPwTl039MTQZpz60bHssJa2/1ai0qfdm6sQDBPOOZ1quy4IwVhLp4vlUFDLSz76wMU8tAqSvtb849No7bxy+k/4LfqeqDrpLe+4g3Kv7QVoSPyrDuVyEgL6uA5rfyfKo6XwrDhPqnzsaXrnWsQaOMJVS+4NkgTFt3qKRfx7aeP3etxv//Np0reFHwyPveaSfdWRQ1McSefdhqd8f/wVH04mAYO6ktoqoHp2pNLxOTKXi3HHB9X8LizGxdUC0xmaJRxqV4L9fvmd6UATgsCK9fz4MuJy6bnxpb7b63OY2n9Y8rmJKw77UmWdi9TAHA+eN8LD7xPuVx9Z4hKoNPXoJcMHKXxxZZr+IwFZUHWHZwONv+176NNNZ/r6LrVBRHUenW8+bOqgpC7Bev088lcEHEdOIOgOUrl/ZcCOHNIFB4cPdzsVtfvRP5SNQ+LOGnnNme7ecehFGsCmvCDto99NsFT+QxItayfw2lfrQgBVZpDy4ck6HF/W65V2Y39pcDQn9bZc0HuqdfUoU1llvbD2En2aSCV7iWyRxEt8Qcg/4HSpazZ2ihalbw9b45xCs8vkfuTAVYdeizd3u+lgBdPvYzFFrc8v1RXm5DG52jPHNRS6hxcC9dDCZqyGoLuOZ1epJYdDNZ8ZxJpQoIPpJY+8evcEoYwYoePfmLSMa6To0v4TK93gbMCEzE5WJ6KUsqLlAdHrTFUd9HKguC28Zo62VZZcQQEWj6EJ4ZXGJqHOsNn166FNqGUi/0uspv67DnWN69wwYUkauonWviFbVIocislvJCznaIpt1n5cs/HiZBzuSjtGgI2XBC2Y2YYWGm3CFyd0PNXf4QWnvQsxj42pMyf0Xo1BZnX1JV/baXVpvozAoEMmuK8Bec5K8CvkfMHeRgtrVtpD9N+/As7F2FQ0B9mjX6kgeU4qxC5jezy4S8i5i3bIpaKGPF4LoUPo4CE5Xz8qdiW81Lfe4Apc4uaqtrCKRMrQ/fTyvJAjAAvDqcSA9Z26z7Yxf0HRj8yy5BACSfvv27f6FWMvUth/+U6DdFyUSn5TWfKEIOIw4F4o6V9lGGq7OW68FrO7Gf6IcYZ3td4v6EZsdWzZYorRjG32CCJaSSgTsXvTIxr31IfcXV428zmu X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9e4a96b9-64ea-4606-57c8-08d93e07758a X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2365.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jul 2021 09:46:41.1847 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: iGMuytPbY+9HONN/0DCfqtfm//XWjmZAOFrO72FvQaIHAR304VX35LuJ7/3eK3whAjtQGEXv5ZJMYplOQIu+cMW76aLlV7+ET+Y0kCPi7Yc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4628 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10033 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 malwarescore=0 mlxscore=0 bulkscore=0 spamscore=0 adultscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107030060 X-Proofpoint-GUID: KUGGDl2aPhVd4CU4z5Ds4zIpBWngLlK- X-Proofpoint-ORIG-GUID: KUGGDl2aPhVd4CU4z5Ds4zIpBWngLlK- X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Guchun Chen , David Airlie , "Pan, Xinhui" , kernel-janitors@vger.kernel.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, John Clements , Christian =?iso-8859-1?q?K=F6nig?= , Dennis Li , Hawking Zhang Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" If copy_to_user() fails then this should return -EFAULT instead of -EINVAL. Fixes: 9b790694a031 ("drm/amdgpu: RAS EEPROM table is now in debugfs") Signed-off-by: Dan Carpenter --- drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c index 3e33e85d8dbc..d2e5b2567bc1 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c @@ -771,7 +771,7 @@ amdgpu_ras_debugfs_eeprom_size_read(struct file *f, char __user *buf, res = min_t(size_t, res, size); if (copy_to_user(buf, &data[*pos], res)) - return -EINVAL; + return -EFAULT; *pos += res; @@ -950,7 +950,7 @@ amdgpu_ras_debugfs_eeprom_table_read(struct file *f, char __user *buf, res = min_t(size_t, res, size); if (copy_to_user(buf, &data[*pos], res)) - return -EINVAL; + return -EFAULT; *pos += res;