Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1828930pxb; Mon, 23 Aug 2021 05:48:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzoWiE1vUeOlsD0Hm3kYI1q189UrotN4LcTD0nE4ObiLjwsv1vHQRRy8c9fFl9uAuzurIY7 X-Received: by 2002:a17:906:32c9:: with SMTP id k9mr8543833ejk.218.1629722890244; Mon, 23 Aug 2021 05:48:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629722890; cv=none; d=google.com; s=arc-20160816; b=Zj095hillY/tGNG4xDVUp97bVo8vRNRgiqRBydK5SchJHypNJNZ8nOQ4aPHAck2vNo lkeLEZZo56tww/g5rd0rsrqd8Isnkko6ZGvUG2mIjW3ZxtRCCHtbUDTs/BA9zZVFUbdm miXnT+sx8wqg8hKxPkv93zmoyzLOlSc5+n2rlmCTn7MqhK6OQ0alYOf6NDSCYuLOEjVH fYRjcsaOt15bvF7R1kFs1Dtt5eMltEeg+Dg6h7gfhwgGJA/RLDveA1wXXiJ/+7gBu9Zm bv/JNgY7hYt4yuWKfa4Ws9+/hnCmdj+J0ZDAfmdBCWKMBIREHDBfglpeChEoLthLK7nb 6tmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:mime-version:message-id:date; bh=R19TvYmRb1bscKZIbqaxxpiW4epqv88K+CvSoGVJ43o=; b=rM7Z3haN6koGp+CbEoGlQBWrKH3XwxFmuWFvzsuF8z8JzCuffNWioA0S7PPpfbHI21 AkmGK0/stxNJJy1D6tZGSgbyrSanHCIhvNi5TxnbejtM/4FmDPxSknPbMzn7HhgtxvfH /+i9M8bRHkNsBnsZPiccycI6OtAxhu27SJE9LhUW3Nw7Inmw2DhVyVyChn2fhIfWOKZ7 UafzCK+5Vp+gaTKX26Xvd6ApI2oTPpnEmSJ+U9QO8UfN/dOMSvUb5fDtW3KI9Vy5RKBO NY6Y/swVkcTqEa8oCp4eCH7PUNKzrf/J2w0WmzruuJ8/Kms/i0b+lj9uAlRaHjfWmUSt Xgsw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d23si14463853ejb.8.2021.08.23.05.47.46; Mon, 23 Aug 2021 05:48:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236868AbhHWMqt (ORCPT + 99 others); Mon, 23 Aug 2021 08:46:49 -0400 Received: from mxhk.zte.com.cn ([63.217.80.70]:41936 "EHLO mxhk.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235954AbhHWMqs (ORCPT ); Mon, 23 Aug 2021 08:46:48 -0400 Received: from mse-fl1.zte.com.cn (unknown [10.30.14.238]) by Forcepoint Email with ESMTPS id 3711BA5E9158F9905E74; Mon, 23 Aug 2021 20:46:02 +0800 (CST) Received: from kjyxh01app01.zte.com.cn ([10.30.12.226]) by mse-fl1.zte.com.cn with SMTP id 17NCjpEJ071935; Mon, 23 Aug 2021 20:45:51 +0800 (GMT-8) (envelope-from yang.yang29@zte.com.cn) Received: from mapi (kjyxh01app01[null]) by mapi (Zmail) with MAPI id mid14; Mon, 23 Aug 2021 20:45:47 +0800 (CST) Date: Mon, 23 Aug 2021 20:45:47 +0800 (CST) X-Zmail-TransId: 2af96123987b663e1db6 X-Mailer: Zmail v1.0 Message-ID: <202108232045471583580@zte.com.cn> Mime-Version: 1.0 From: To: , Cc: , , Subject: =?UTF-8?B?W1BBVENIXSBkaW86IGFkZCBtaXNzaW5nIGlvdW5tYXAoKSBhZnRlciBpb3JlbWFwKCk=?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl1.zte.com.cn 17NCjpEJ071935 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: xu xin If kzalloc() fails, the 'va' needs to be unmapped before returning -ENOMEM. Reported-by: Zeal Robot Signed-off-by: xu xin --- drivers/dio/dio.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletions(-) diff --git a/drivers/dio/dio.c b/drivers/dio/dio.c index 4c06c93..7d19250 100644 --- a/drivers/dio/dio.c +++ b/drivers/dio/dio.c @@ -218,9 +218,11 @@ static int __init dio_init(void) /* Found a board, allocate it an entry in the list */ dev = kzalloc(sizeof(struct dio_dev), GFP_KERNEL); - if (!dev) + if (!dev) { + if (scode >= DIOII_SCBASE) + iounmap(va); return -ENOMEM; + } dev->bus = &dio_bus; dev->dev.parent = &dio_bus.dev; dev->dev.bus = &dio_bus_type; -- 2.15.2