Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760023AbbLCNUa (ORCPT ); Thu, 3 Dec 2015 08:20:30 -0500 Received: from mout.kundenserver.de ([212.227.126.131]:61991 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750805AbbLCNU2 (ORCPT ); Thu, 3 Dec 2015 08:20:28 -0500 From: Arnd Bergmann To: Lee Jones Cc: linux-arm-kernel@lists.infradead.org, Bjorn Andersson , Ohad Ben-Cohen , "devicetree@vger.kernel.org" , Florian Fainelli , kernel@stlinux.com, Nathan_Lynch@mentor.com, "linux-kernel@vger.kernel.org" , ludovic.barre@st.com, Maxime Coquelin Subject: Re: [RESEND v4 2/6] remoteproc: debugfs: Add ability to boot remote processor using debugfs Date: Thu, 03 Dec 2015 14:19:47 +0100 Message-ID: <2600153.9u9Z7N2IT1@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <20151203130341.GA26902@x1> References: <1448370862-19120-1-git-send-email-lee.jones@linaro.org> <5329827.I5W30K072M@wuerfel> <20151203130341.GA26902@x1> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:RmVbCK61BSODeouBTCUKNIUtkM89SkgqEtGo6E8nyk4PKDNoD0z NasX4b/oEJ33mx52pKwJVlVXZ1IxYD8tW7a4eank75ZQQhNwuJu+9N4c+Be/zq+ANuDze1l 1ZJk2WhCY1KOnY1/fYsOKK5VH3uMCgwcvP39vKu5eQIQz888x4h0jkgN76wOa78KbQnu15p NdEDz3NBs2vecH99qxwPw== X-UI-Out-Filterresults: notjunk:1;V01:K0:U6J1RBE0dIA=:ebcxDBCQcjGx2YTMFIMwKO pptUv7YqQ+Gb/ikAMdtdo547YXs6KFQb5ZfIfud2b9mMW27d7qdeR8+aPcibtmxBSm6h1INRk x6NHNl1MjOnkA8I76fOvCDJgkldZ3ePdhLVT6r+162XrtB+oxkfl6q13lMuLD7ePcCLf3tcn1 yVgCQ0D6nsefO5McS3VmcI2HqTh/XlUaK+s+36fu+IcXuGq0klsWuUvD9pU3nTyMpBNjGEuVZ lkcaJw+OFw2nY4+URgcQ9/VxjMQlnbHfeI+K1J3zYgFR6yqNOuvqkPTkCWvt1cxtC5wdRaq8i auweqpTpx36OOBBveIuvs2aO3R/s53c8Pn9P0PiUT8BwlD2KrXBU9JAAJCDV9gsbvjozuSBGt uyfrszXab/EV1Q2vCeDfxrNl+T42/QeIkjbmlaIiYH234Ls+LL2cPbVSt/rg/7PSaBU1JVzAd 5WOixHy9EEpdyS5acGV4fmTnpne7uOCkjh2reZ7eewwrVQ7L0EQVyYXyB05B6v6mkuqZRQ1vS r35LHi3tLUMb3aaFpyDwe/K0czlp90xLa0OCj+2DsnvNJhJa2l7XNc2ruERU0RtCfcsN6bslm t/on7IvofmCzCxFnlb6phAbi5kLEhzEGrNOaGENrqNhkSJcZ8a8pWnj7BTkktEEB5IDylfeAW 602ed+cJw7Qec9fVxxD9QquhHSEcEbcNWSeDPpDR6D0VdLBk/nfN7uci2/5BNVYffYmyF7+qq Wl0HOdwyqAqIdbLp Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1739 Lines: 47 On Thursday 03 December 2015 13:03:41 Lee Jones wrote: > On Thu, 03 Dec 2015, Arnd Bergmann wrote: > > > On Thursday 03 December 2015 12:26:34 Lee Jones wrote: > > > > > > > > > > +static ssize_t rproc_state_write(struct file *filp, const char __user *userbuf, > > > > > + size_t count, loff_t *ppos) > > > > > +{ > > > > > + struct rproc *rproc = filp->private_data; > > > > > + char buf[10]; > > > > > + int ret; > > > > > + > > > > > + if (count > sizeof(buf)) > > > > > + return count; > > > > > + ret = copy_from_user(buf, userbuf, count); > > > > > + if (ret) > > > > > + return -EFAULT; > > > > > + > > > > > + if (buf[count - 1] == '\n') > > > > > + buf[count - 1] = '\0'; > > > > > > > > I believe you can get here with count = 0. > > > > > > I'm pretty sure you can't. > > > > > > If you are sure that you can, if you can provide me with a way of > > > testing, I'd be happy to put in provisions. > > > > > > > I think that a zero-length write() from user space ends up in the write > > file operation. > > I tested this and didn't see it enter write(). My conclusion was that > if the file doesn't change, then nothing is triggered. > Ah, interesting. I haven't tried myself, and just tried to read the code. Maybe glibc already catches zero-length writes before it gets into the kernel, or I just missed the part of the syscall that checks for this. arnd -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/