From patchwork Sun Oct 11 19:47:20 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Stava X-Patchwork-Id: 53021 X-Patchwork-Delegate: ericvh@gmail.com Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9BJmfCC000529 for ; Sun, 11 Oct 2009 19:48:41 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-2.v29.ch3.sourceforge.com) by 3yr0jf1.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1Mx4O9-0005mK-Nr; Sun, 11 Oct 2009 19:47:29 +0000 Received: from sfi-mx-4.v28.ch3.sourceforge.com ([172.29.28.124] helo=mx.sourceforge.net) by 3yr0jf1.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1Mx4O8-0005mA-Cx for v9fs-developer@lists.sourceforge.net; Sun, 11 Oct 2009 19:47:28 +0000 Received-SPF: pass (1b2kzd1.ch3.sourceforge.com: domain of gmail.com designates 209.85.219.205 as permitted sender) client-ip=209.85.219.205; envelope-from=martin.stava@gmail.com; helo=mail-ew0-f205.google.com; Received: from mail-ew0-f205.google.com ([209.85.219.205]) by 1b2kzd1.ch3.sourceforge.com with esmtp (Exim 4.69) id 1Mx4O1-0008Lh-W7 for v9fs-developer@lists.sourceforge.net; Sun, 11 Oct 2009 19:47:28 +0000 Received: by mail-ew0-f205.google.com with SMTP id 1so360130ewy.10 for ; Sun, 11 Oct 2009 12:47:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.211.126.15 with SMTP id d15mr3189248ebn.19.1255290440691; Sun, 11 Oct 2009 12:47:20 -0700 (PDT) In-Reply-To: References: Date: Sun, 11 Oct 2009 21:47:20 +0200 Message-ID: From: Martin Stava To: V9FS Developers X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record -0.0 DKIM_VERIFIED Domain Keys Identified Mail: signature passes verification 0.0 DKIM_SIGNED Domain Keys Identified Mail: message has a signature -0.0 AWL AWL: From: address is in the auto white-list X-Headers-End: 1Mx4O1-0008Lh-W7 Subject: Re: [V9fs-developer] Readlink patch X-BeenThere: v9fs-developer@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: v9fs-developer-bounces@lists.sourceforge.net diff -uprN -X linux-2.6.31.1-vanilla/Documentation/dontdiff linux-2.6.31.1-vanilla/fs/9p/vfs_inode.c linux-2.6.31.1/fs/9p/vfs_inode.c --- linux-2.6.31.1-vanilla/fs/9p/vfs_inode.c 2009-09-24 17:45:25.000000000 +0200 +++ linux-2.6.31.1/fs/9p/vfs_inode.c 2009-10-03 14:04:42.000000000 +0200 @@ -939,7 +939,7 @@ static int v9fs_readlink(struct dentry * P9_DPRINTK(P9_DEBUG_VFS, "%s -> %s (%s)\n", dentry->d_name.name, st->extension, buffer); - retval = buflen; + retval = min(strlen(st->extension), (size_t)buflen); done: kfree(st); @@ -1007,7 +1007,7 @@ static void *v9fs_vfs_follow_link(struct __putname(link); link = ERR_PTR(len); } else - link[len] = 0; + link[min(len, PATH_MAX-1)] = 0; } nd_set_link(nd, link);