Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp502514pxu; Sun, 25 Oct 2020 07:46:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdhOvswoKCnzJJ6cbVtpK5OwRTlu012M6DSORX4j7e1FZ/SbQGBsLeSKzYC/YM7473RyRK X-Received: by 2002:a17:907:10cc:: with SMTP id rv12mr11290033ejb.451.1603637165464; Sun, 25 Oct 2020 07:46:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603637165; cv=none; d=google.com; s=arc-20160816; b=wyc0BV0qOkAZIgjmHgCOgwSlLQDt9xvTQw9HiP7CWRjHke7RA1Wv+V4weBxTyY2Z2o cYkL9Cou1ttBh387UvYMoRy7gy7G0Xm71xtK9rs3m8yRZX6qExfmRIrzCe4SSFb+ctOp HemIiRi4DG5ja0B9C3rcRgsY15DlfUCMHXQV3kJ2/t4OJ7ssLRoD+kN6BH7J3GuzU6J0 X+a/a7qZZMyxMc0tfzSr75LwZpTnaQQBP3z19UQbtBha397+P8gtaXNR4HlYp+NvC52F IUCeIY+pZuWxjZ47QxNR9Qu59omQjDFb9hi7lKrb2lgYnzXDMN3HoquxkIjBh5sNFMmM 9ijg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ktBxi/1ghRm1dSb7T8JBIhiNOsB6IY3tOdDngk7/hKE=; b=TDBteHAT4oYBMaTOgmSK9vId423sb/2TvJspbjr1yKYi7T3u+v1pICe+qmYq77XG2t Sl8S1UaPjJN1dERFjx11fDlg4K0WNlfwGUf7dKycXJ87MVUbUKBbPRHgwHk2Z9WMh5qK hlLE0rX6+cH4xYBKK27BhizzXhWQ+7wThQdrt5BRdkZlC0Ypu3EN9aBhThtINqgzNnhV VLqy4FZQpIDT9douwDmhQ2Grr+KWB8/kVHWmcbzkYE8GBShRB4dgYYwq41qrQ+yLg9Py 7pybLibn2OmlvcqoYG5SelG7v1XLMB6j/ygy3Xr3TSq8Dg1Pz39RCkTXJdmP2qbg/xk3 HAiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=WXJfTi72; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v3si4881753ejq.157.2020.10.25.07.45.42; Sun, 25 Oct 2020 07:46:05 -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; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=WXJfTi72; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1416026AbgJYMpX (ORCPT + 99 others); Sun, 25 Oct 2020 08:45:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1416022AbgJYMpX (ORCPT ); Sun, 25 Oct 2020 08:45:23 -0400 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F4C1C0613D0 for ; Sun, 25 Oct 2020 05:45:22 -0700 (PDT) Received: by mail-ej1-x643.google.com with SMTP id t25so9477557ejd.13 for ; Sun, 25 Oct 2020 05:45:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ktBxi/1ghRm1dSb7T8JBIhiNOsB6IY3tOdDngk7/hKE=; b=WXJfTi729d7VXmvhTGeemJ0YNTcw6dfh+TmbiD3fd25RIvtbWoVonN0WBoy6obXwyy q+Z99WQlhpeIj93Oct5Aj0LZy24SrRGzaHHc/B/TW5Ig+CrRDnly6MUd8UZ7erx89CnL YfU1k806d3ZZVKHb476gQenT96YHSIDW5Abik= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ktBxi/1ghRm1dSb7T8JBIhiNOsB6IY3tOdDngk7/hKE=; b=J9K5wofmg7h9g5Z4oex2cylIkTZKdghWnuzOA7iuBmCvhQ/JeQUPOprxcFSa7OJP+U BDKer4VTd2SKu9Eys+Dp8dPR63pEUif54R70Z24K5emk7DeqwpDTRTgCYtPVKY4bjxYv 6kmKqESwLPIhGR5cIVQHJesSsdPeCqEeoDsbMzCqStyB+xyTa6LRdROZofWW8D7W+xKi nTiQSOBQo6pafYUUVmUeN9G7BXUZJ67YwwY4T5KegFIPVGC1uUi51n8rdbt5fbOqI67d uYbRm16r6hW7Aypu1qHqy3zZQIZpQPjlAFTjq0M8ofJ4N/by6GC/lTSgdqAKDkqVTP8R LPbw== X-Gm-Message-State: AOAM531oBsoAHhOQyfgeSCkGN1Uv4XnLF+CewBsJb478bk8g4PoxViFT rjFSbR4XhNnXgtCSgD1vPpu3gQy5EO6P4SZM X-Received: by 2002:a17:907:206e:: with SMTP id qp14mr11019060ejb.76.1603629921202; Sun, 25 Oct 2020 05:45:21 -0700 (PDT) Received: from prevas-ravi.prevas.se (5.186.115.188.cgn.fibianet.dk. [5.186.115.188]) by smtp.gmail.com with ESMTPSA id t8sm3920954ejc.45.2020.10.25.05.45.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Oct 2020 05:45:20 -0700 (PDT) From: Rasmus Villemoes To: Wim Van Sebroeck , Guenter Roeck Cc: Rasmus Villemoes , kernel test robot , linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] watchdog: sbc_fitpc2_wdt: add __user annotations Date: Sun, 25 Oct 2020 13:45:18 +0100 Message-Id: <20201025124518.31647-1-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org After a change to the put_user() macro on x86, kernel test robot has started sending me complaints (from sparse) about passing kernel pointers to put_user(). So add the __user annotations to the various casts in fitpc2_wdt_ioctl(), and while in here, also make the write method actually match the prototype of file_operations::write. Reported-by: kernel test robot Signed-off-by: Rasmus Villemoes --- drivers/watchdog/sbc_fitpc2_wdt.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/watchdog/sbc_fitpc2_wdt.c b/drivers/watchdog/sbc_fitpc2_wdt.c index 04483d6453d6a147703e..13db71e165836eb73249 100644 --- a/drivers/watchdog/sbc_fitpc2_wdt.c +++ b/drivers/watchdog/sbc_fitpc2_wdt.c @@ -78,7 +78,7 @@ static int fitpc2_wdt_open(struct inode *inode, struct file *file) return stream_open(inode, file); } -static ssize_t fitpc2_wdt_write(struct file *file, const char *data, +static ssize_t fitpc2_wdt_write(struct file *file, const char __user *data, size_t len, loff_t *ppos) { size_t i; @@ -125,16 +125,16 @@ static long fitpc2_wdt_ioctl(struct file *file, unsigned int cmd, switch (cmd) { case WDIOC_GETSUPPORT: - ret = copy_to_user((struct watchdog_info *)arg, &ident, + ret = copy_to_user((struct watchdog_info __user *)arg, &ident, sizeof(ident)) ? -EFAULT : 0; break; case WDIOC_GETSTATUS: - ret = put_user(0, (int *)arg); + ret = put_user(0, (int __user *)arg); break; case WDIOC_GETBOOTSTATUS: - ret = put_user(0, (int *)arg); + ret = put_user(0, (int __user *)arg); break; case WDIOC_KEEPALIVE: @@ -143,7 +143,7 @@ static long fitpc2_wdt_ioctl(struct file *file, unsigned int cmd, break; case WDIOC_SETTIMEOUT: - ret = get_user(time, (int *)arg); + ret = get_user(time, (int __user *)arg); if (ret) break; @@ -157,7 +157,7 @@ static long fitpc2_wdt_ioctl(struct file *file, unsigned int cmd, fallthrough; case WDIOC_GETTIMEOUT: - ret = put_user(margin, (int *)arg); + ret = put_user(margin, (int __user *)arg); break; } -- 2.23.0