Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp287476pxb; Fri, 15 Jan 2021 03:21:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJwtstCj3T3iGCz2exdWhkf+GSL2UM0zsNJbpMk7vlm4m5R+yLPMpY2wiukPwDfQGp9NZ/sc X-Received: by 2002:aa7:d906:: with SMTP id a6mr9340655edr.121.1610709680486; Fri, 15 Jan 2021 03:21:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610709680; cv=none; d=google.com; s=arc-20160816; b=Br9BlnTd3V5tRzqJri7E0eA7GKTwsXcOoH1aF2By/g4ajwUUL3/7rMzIhfWEy25NXm BdasWEbStctRU1nsM4/0V/MhxOSN5QELGZEiLfXzbFe85meQFlpVRTsitB2LJapNIU2l XmOOr7H8ESt+yrvFj7JXDGIX2/ltBm0GvTdCeUeifcx2WImdwST+AO59Zxo3oUywL/MJ ivYKm+GXVVu9Ricqgs2qL3/Y59JzMHB3QqjIwlXgDnSB3Th2Pr+XW48yh0t2fYkyQyTj jZPGXXWCkMqzC1xu1aGdSmWH3AdM/EsiwigBtd2/IJXafgXPE6UFSU5t5LKd7lnaFE45 nYaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=8lRJYc4BKAdg1abXpS4nArMEOY798PG8SuBDu3ZJSlk=; b=jQ8TIuNpHbjILCD7Bth8r5r7v63JUwl5L+Kw+Q5oMQzrdqZBk+pVvIGASSXDyr5pC2 6tQIh9k3d9AWzT2JS5FZpwT9oBdfuZSanG/16ujHxiOI4WMIFdJC+TtU+T6ubR0ybJD3 WFhuUxuXB1Kb7lsY0K5BETKZyENJAwIjRLfmwUiTe7XwURISFJpdcV0HLMszTNV8wjJz GSugYHhAfJqSzU5dJXusrHOcBtKSI91kWIV/rGk5Dgx9HA/d1fNBbpX5ecl20d/EvKQz +ghPmwulDom7klK7swShx1ibmYFIhetHsz8yAQMlLxV9jsWNwhRWtCxmT3j9ng1suKMZ dhNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Z5AjfT+9; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s11si3910373edy.18.2021.01.15.03.20.56; Fri, 15 Jan 2021 03:21:20 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=Z5AjfT+9; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727966AbhAOLTX (ORCPT + 99 others); Fri, 15 Jan 2021 06:19:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727009AbhAOLTW (ORCPT ); Fri, 15 Jan 2021 06:19:22 -0500 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E33C8C061793; Fri, 15 Jan 2021 03:18:41 -0800 (PST) Received: by mail-lf1-x12d.google.com with SMTP id h205so12584105lfd.5; Fri, 15 Jan 2021 03:18:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=8lRJYc4BKAdg1abXpS4nArMEOY798PG8SuBDu3ZJSlk=; b=Z5AjfT+9sIEoizTRGkvN4w7h+aIbEWUFfVlvbDDmlnjohr4b0yWluxpJGKYyhP8D/V I1i0WOneHrJlvabZSEV484vqeRo06wzgYuy4/74GQxjPiexyiI2Fkm1ofKktZpg7HkEF r4ZvbU4mI0geYG/QB4JeSCJf9N8xgug1O0oF5ndx9wZAMViLLczKz9zrs25GRrbzUDEv BJMyglfRGKtxkz4nP7IGeIWrG8nPeHLzf8SGJ9CXAJE6BD9YW/chFgczD1Sznmje0srx hhkjxqAvvBo8ZwYRisJz7S9OxGneqG3bM72c4IQ6Shyld3PwIXKv9EAlWxxvF/sX+Hcn DGOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=8lRJYc4BKAdg1abXpS4nArMEOY798PG8SuBDu3ZJSlk=; b=LrrYOgSvoFZZfGFNnQCC1EQB/hB+Mr7Iso+Vzx9YfpVJRYyTJBPT0AcVd9Zf2ycQkn MMXWM+janQbwgGN73MKpjv/Of04ZJN5R/wU6VnATR6bW4mQdJKV6LzCt5aLNQelwhu/W FpwFCnr7pVTL1hAlzK0bPbMpuIhRbGNbr4sLKYxSWq7dF4/mWtYy/unzBP2dfKgSv+Sd xKtJ4veYKsG1iTUPWhhCC6bPThztZ9vtv72ZVfaI5FSEWMy0qeAuPqi75ekfPT9qkj1O h6G0utJdCIX4lgGSuie1/eEFLalFB3EqVf4X7SRHcF/HDZOmXeiI1kgf66rx/o4HoBvC zIjg== X-Gm-Message-State: AOAM5310ZbAGUg937/+/B6hZAW+6yXt0m4q0tsLjTE1oOjpBROFmbJYe nUDAgUTF3RGvv9CzG83MYrc= X-Received: by 2002:a05:6512:3157:: with SMTP id s23mr5355726lfi.275.1610709520473; Fri, 15 Jan 2021 03:18:40 -0800 (PST) Received: from home.paul.comp (paulfertser.info. [2001:470:26:54b:226:9eff:fe70:80c2]) by smtp.gmail.com with ESMTPSA id x125sm864994lff.58.2021.01.15.03.18.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jan 2021 03:18:39 -0800 (PST) Received: from home.paul.comp (home.paul.comp [IPv6:0:0:0:0:0:0:0:1]) by home.paul.comp (8.15.2/8.15.2/Debian-14~deb10u1) with ESMTP id 10FBIaNw004539; Fri, 15 Jan 2021 14:18:37 +0300 Received: (from paul@localhost) by home.paul.comp (8.15.2/8.15.2/Submit) id 10FBITBj004538; Fri, 15 Jan 2021 14:18:29 +0300 Date: Fri, 15 Jan 2021 14:18:29 +0300 From: Paul Fertser To: Ernesto Corona Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, Viresh Kumar , Linus Walleij , Palmer Dabbelt , Amithash Prasad , Rgrs , Christian Gromm , Yiwei Zhang , Joel Stanley , Steven Filary , Alessandro Rubini , Kees Cook , Arnd Bergmann , Johan Hovold , William Breathitt Gray , Jiri Pirko , Jonathan Cameron , Mika Westerberg , Jens Axboe , Tony Luck , Boris Brezillon , Greg Kroah-Hartman , Randy Dunlap , Patrick Williams , Federico Vaga , Oleksandr Shamray , Vadim Pasternak Subject: Re: [PATCH v29 1/6] drivers: jtag: Add JTAG core driver Message-ID: <20210115111829.GB2971@home.paul.comp> References: <20200413222920.4722-1-ernesto.corona@intel.com> <20200413222920.4722-2-ernesto.corona@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200413222920.4722-2-ernesto.corona@intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 13, 2020 at 03:29:15PM -0700, Ernesto Corona wrote: > --- /dev/null > +++ b/drivers/jtag/jtag.c > + case JTAG_SIOCFREQ: > + if (!jtag->ops->freq_set) > + return -EOPNOTSUPP; > + > + if (get_user(value, (__u32 __user *)arg)) > + return -EFAULT; Does this need to be a pointer to a variable even if it's just a number? > + case JTAG_IOCXFER: > + if (copy_from_user(&xfer, (const void __user *)arg, > + sizeof(struct jtag_xfer))) > + return -EFAULT; > + > + if (xfer.length >= JTAG_MAX_XFER_DATA_LEN) > + return -EINVAL; > + > + if (xfer.type > JTAG_SDR_XFER) > + return -EINVAL; > + > + if (xfer.direction > JTAG_READ_WRITE_XFER) > + return -EINVAL; > + > + if (xfer.endstate > JTAG_STATE_UPDATEIR) > + return -EINVAL; > + > + data_size = DIV_ROUND_UP(xfer.length, BITS_PER_BYTE); > + xfer_data = memdup_user(u64_to_user_ptr(xfer.tdio), data_size); So this might copy more bits than the user specified, but that's probably OK. > + if (IS_ERR(xfer_data)) > + return -EFAULT; > + > + err = jtag->ops->xfer(jtag, &xfer, xfer_data); > + if (err) { > + kfree(xfer_data); > + return err; > + } > + > + err = copy_to_user(u64_to_user_ptr(xfer.tdio), > + (void *)xfer_data, data_size); And this might overwrite some bits and it's not OK, at least not without a warning in the documentation. > --- /dev/null > +++ b/include/uapi/linux/jtag.h > @@ -0,0 +1,194 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +// include/uapi/linux/jtag.h - JTAG class driver uapi > +// > +// Copyright (c) 2018 Mellanox Technologies. All rights reserved. > +// Copyright (c) 2018 Oleksandr Shamray > + > +#ifndef __UAPI_LINUX_JTAG_H > +#define __UAPI_LINUX_JTAG_H > + Missing Other API comments will be sent as a reply to the "Documentation: jtag: Add ABI documentation" patch as they are not implementation-specific. -- Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software! mailto:fercerpav@gmail.com