From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6BD9C4320A for ; Fri, 30 Jul 2021 00:57:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B0E9160E09 for ; Fri, 30 Jul 2021 00:57:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233125AbhG3A5S (ORCPT ); Thu, 29 Jul 2021 20:57:18 -0400 Received: from zeniv-ca.linux.org.uk ([142.44.231.140]:42938 "EHLO zeniv-ca.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229667AbhG3A5P (ORCPT ); Thu, 29 Jul 2021 20:57:15 -0400 Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m9Gpn-0053HG-6t; Fri, 30 Jul 2021 00:57:07 +0000 Date: Fri, 30 Jul 2021 00:57:07 +0000 From: Al Viro To: Vivek Goyal Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, hch@lst.de, virtio-fs@redhat.com, v9fs-developer@lists.sourceforge.net, stefanha@redhat.com, miklos@szeredi.hu Subject: Re: [PATCH v3 3/3] fs: simplify get_filesystem_list / get_all_fs_names Message-ID: References: <20210714202321.59729-1-vgoyal@redhat.com> <20210714202321.59729-4-vgoyal@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210714202321.59729-4-vgoyal@redhat.com> Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 14, 2021 at 04:23:21PM -0400, Vivek Goyal wrote: > +static int __init split_fs_names(char *page, char *names) > { > + int count = 0; > + char *p = page; > > + strcpy(p, root_fs_names); > + while (*p++) { > + if (p[-1] == ',') > + p[-1] = '\0'; > } > + *p = '\0'; > + > + for (p = page; *p; p += strlen(p)+1) > + count++; > > + return count; > } Ummm.... The last part makes no sense - it counts '\0' in the array pointed to be page, until the first double '\0' in there. All of which had been put there by the loop immediately prior to that one... Incidentally, it treats stray ,, in root_fs_names as termination; is that intentional?