Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932486AbbKQVWt (ORCPT ); Tue, 17 Nov 2015 16:22:49 -0500 Received: from mail-yk0-f175.google.com ([209.85.160.175]:36520 "EHLO mail-yk0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754843AbbKQVWb (ORCPT ); Tue, 17 Nov 2015 16:22:31 -0500 Date: Tue, 17 Nov 2015 16:22:26 -0500 From: Tejun Heo To: David Miller Cc: pablo@netfilter.org, kaber@trash.net, kadlec@blackhole.kfki.hu, lizefan@huawei.com, hannes@cmpxchg.org, netdev@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com, daniel@iogearbox.net, daniel.wagner@bmw-carit.de, nhorman@tuxdriver.com, gregkh@linuxfoundation.org Subject: Re: [PATCH 2/5] kernfs: implement kernfs_walk_and_get() Message-ID: <20151117212226.GG22864@mtj.duckdns.org> References: <1447789240-29394-1-git-send-email-tj@kernel.org> <1447789240-29394-3-git-send-email-tj@kernel.org> <20151117.162040.1412296298973879057.davem@davemloft.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151117.162040.1412296298973879057.davem@davemloft.net> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 805 Lines: 29 On Tue, Nov 17, 2015 at 04:20:40PM -0500, David Miller wrote: > From: Tejun Heo > Date: Tue, 17 Nov 2015 14:40:37 -0500 > > > + static char path_buf[PATH_MAX]; /* protected by kernfs_mutex */ > > + int len = strlen(path); > ... > > + if (len >= PATH_MAX) > > + return NULL; > > + > > + memcpy(path_buf, path, len + 1); > > static char path_buf[PATH_MAX]; /* protected by kernfs_mutex */ > int len = strlcpy(path_buf, path, PATH_MAX); > ... > if (len >= PATH_MAX) > return NULL; That's a lot better. Will update. Thanks. -- tejun -- 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/