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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8465FECAAD5 for ; Thu, 1 Sep 2022 19:35:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234379AbiIATfe (ORCPT ); Thu, 1 Sep 2022 15:35:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234043AbiIATfb (ORCPT ); Thu, 1 Sep 2022 15:35:31 -0400 Received: from mail-qv1-xf2c.google.com (mail-qv1-xf2c.google.com [IPv6:2607:f8b0:4864:20::f2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D54C371B2 for ; Thu, 1 Sep 2022 12:35:30 -0700 (PDT) Received: by mail-qv1-xf2c.google.com with SMTP id f9so10582574qvw.11 for ; Thu, 01 Sep 2022 12:35:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=UTBH3ZdVXDU80DZLVRDqtIzjJqfExVq6UuHtVbe7ytw=; b=cc6qIcfeYMZ/SYFhyoOYaOlejSar4fvt7eaC6hWph8Vm89PxHJePz6jHQuUA3uKOxW xoTb/FIeZEjEW9w4NCFuhaYpPrfpJV/zJIvQufFLDvYJBV7rG0whxvGEaiET0X4TnOKI CSxHkTzgBb8BNcBUXa8evSulFwvVWMOZxIt6Xq7Iy/0ifZixSTfYHgKw8O7+5E4bZSaz IwcCzXTwudYYjaV7t+vQkIg8sXbOoMQYCDo7bFvAUQ9/3bNuTFPDqiIOzv11BkZhxiIH 0CtLSbVdwVcJ+EDSJAr48KcnueG6sU7NHnMJu9KdeaNijV2p21nG5lVZ1LSvqy8PbkTP ARyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=UTBH3ZdVXDU80DZLVRDqtIzjJqfExVq6UuHtVbe7ytw=; b=cmZuzl2HIeLZLe7uLj/CedRvMeROvgPI142qeVHu7qt6fnQ6Ld43KbaBid16e2setG d8xcWfnYQGvF0IkQ5K72twy2KGOi9YtqkBMbGowTzPDbFY2yByTm0BA6PTVpbnVtIYRO y6gytNL2HhUvJaeIUbiGMjFt97Wh4Q98ynApRTbTvRiMxxqnwMzV+E2FF900KKWW9NqC wQ510PbDbF3P/IjCh/1UDYPdUhd1BwXVkbedJ11OP6yTEY5ieUbmZXhFYXMA/VsoF44O SwJ/6ZVMhAuZZQmFE+NW9E2w8lOB1VYA6O4CWtMq1yRUeKGhF5THQei41paJQoycfQ9w qFiw== X-Gm-Message-State: ACgBeo0L76pHbS84KCkFblQxx1j5gmOK0ppjvZrM/PWd03rNNNEJIsIu X71JeOG8a2OJ/26j4uCKxqzRxT1U15tq1cAQnzE= X-Google-Smtp-Source: AA6agR7zE5vM3379YmH+8og+0FzDs/kfGFEcxRhQLFhYOuDVffSnUvhdWpR+hcl+9VqRuiFaxcnc+E962KezfuFf5sw= X-Received: by 2002:a05:6214:c8f:b0:499:21eb:ba3b with SMTP id r15-20020a0562140c8f00b0049921ebba3bmr7362076qvr.97.1662060929333; Thu, 01 Sep 2022 12:35:29 -0700 (PDT) MIME-Version: 1.0 References: <20220901175022.334824-1-cezary.rojewski@intel.com> <20220901175022.334824-2-cezary.rojewski@intel.com> In-Reply-To: <20220901175022.334824-2-cezary.rojewski@intel.com> From: Andy Shevchenko Date: Thu, 1 Sep 2022 22:34:53 +0300 Message-ID: Subject: Re: [PATCH v3 1/2] lib/string_helpers: Introduce tokenize_user_input() To: Cezary Rojewski Cc: ALSA Development Mailing List , Mark Brown , Takashi Iwai , Jaroslav Kysela , amadeuszx.slawinski@linux.intel.com, Pierre-Louis Bossart , Hans de Goede , Liam Girdwood , Kai Vehmanen , =?UTF-8?Q?P=C3=A9ter_Ujfalusi?= , Ranjani Sridharan , Bard Liao , Andy Shevchenko , Linux Kernel Mailing List , Matthew Wilcox Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 1, 2022 at 8:40 PM Cezary Rojewski wrote: > > Add new helper function to allow for splitting specified user string > into a sequence of integers. Internally it makes use of get_options() so > the returned sequence contains the integers extracted plus an additional > element that begins the sequence and specifies the integers count. Thanks! In general it looks good to me, but a few minor comments below. ... > +int tokenize_user_input(const char __user *from, size_t count, int **tkns); Not sure how I can deduct from the name what function is actually doing. Suggested new name: int_array_parse_user(). int int_array_parse_user(const char __user *from, size_t count, int **array); (Note that we have _user suffix for many APIs in the kernel that does interact with user space memory) ... > + * @tkns: Returned pointer to sequence of integers array ... If you are okay with this, you may add my Reviewed-by: Andy Shevchenko -- With Best Regards, Andy Shevchenko 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 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 459F3ECAAD5 for ; Thu, 1 Sep 2022 19:36:33 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 9643C1632; Thu, 1 Sep 2022 21:35:41 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9643C1632 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1662060991; bh=gl37VaknvPtE505jNEGScISD9lh8tGLuJYSua8K+tcE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=jGqow1Q9A20iog4iqsn5DZTETHQ63Ozkh311tMnQqXtFQ53PhKxQC0R1tI6yM7JNN Vv4wGAULkiUznxEJhXUzva7VZrDNGT1SvgCN32O4gWtNoc/nquJgPW+Xoe098hV6tZ T3YDx9Du2DoCrMKKfS4DLlpA3WoQ0KDsy0jzrLy4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 19D4FF800EB; Thu, 1 Sep 2022 21:35:41 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 925F0F8026D; Thu, 1 Sep 2022 21:35:39 +0200 (CEST) Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id AAA91F800EB for ; Thu, 1 Sep 2022 21:35:31 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz AAA91F800EB Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cc6qIcfe" Received: by mail-qv1-xf2f.google.com with SMTP id l5so14224537qvs.13 for ; Thu, 01 Sep 2022 12:35:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=UTBH3ZdVXDU80DZLVRDqtIzjJqfExVq6UuHtVbe7ytw=; b=cc6qIcfeYMZ/SYFhyoOYaOlejSar4fvt7eaC6hWph8Vm89PxHJePz6jHQuUA3uKOxW xoTb/FIeZEjEW9w4NCFuhaYpPrfpJV/zJIvQufFLDvYJBV7rG0whxvGEaiET0X4TnOKI CSxHkTzgBb8BNcBUXa8evSulFwvVWMOZxIt6Xq7Iy/0ifZixSTfYHgKw8O7+5E4bZSaz IwcCzXTwudYYjaV7t+vQkIg8sXbOoMQYCDo7bFvAUQ9/3bNuTFPDqiIOzv11BkZhxiIH 0CtLSbVdwVcJ+EDSJAr48KcnueG6sU7NHnMJu9KdeaNijV2p21nG5lVZ1LSvqy8PbkTP ARyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=UTBH3ZdVXDU80DZLVRDqtIzjJqfExVq6UuHtVbe7ytw=; b=afjEDbbttNrJKbIRSbcN9FqsKQScuLfVeuM2CurLnLxmG9++ZPeOZdup3JWSOfmr+v imnHu4K60C/RhZNNqwBx0cP9FPjw8VzvUK32fcS6k7XNeVyxiMBaGf27LfCQPSiU8wkq fh2txfSc5O8F9Xw0kS261ro66CFJFl9EsG0v4wHghxJGyiMlsWZn7jNn9SY99CXxaR+d thKOfLt4MTiARWMSqNyTgt65jpFhWNzT6onryghS2XfAcYsir8noFGxtFimvZf8/8PCw 4EJK1H3oKkSKbneLnZ/s/OOs7MP6tTUXub2pQIno0guFktMvzXH6mTTUwxFJUJUI5lfC BTJQ== X-Gm-Message-State: ACgBeo1UQXj4rKVHWwuPfKH4LbkKVc+cYDiPum/Q09gH4T0gxLw+RaOl /HRvRZf9AHq61ynYnoKTrFt5Ee9B2BGI/mZKPE0= X-Google-Smtp-Source: AA6agR7zE5vM3379YmH+8og+0FzDs/kfGFEcxRhQLFhYOuDVffSnUvhdWpR+hcl+9VqRuiFaxcnc+E962KezfuFf5sw= X-Received: by 2002:a05:6214:c8f:b0:499:21eb:ba3b with SMTP id r15-20020a0562140c8f00b0049921ebba3bmr7362076qvr.97.1662060929333; Thu, 01 Sep 2022 12:35:29 -0700 (PDT) MIME-Version: 1.0 References: <20220901175022.334824-1-cezary.rojewski@intel.com> <20220901175022.334824-2-cezary.rojewski@intel.com> In-Reply-To: <20220901175022.334824-2-cezary.rojewski@intel.com> From: Andy Shevchenko Date: Thu, 1 Sep 2022 22:34:53 +0300 Message-ID: Subject: Re: [PATCH v3 1/2] lib/string_helpers: Introduce tokenize_user_input() To: Cezary Rojewski Content-Type: text/plain; charset="UTF-8" Cc: Andy Shevchenko , ALSA Development Mailing List , Kai Vehmanen , Liam Girdwood , Bard Liao , Pierre-Louis Bossart , Matthew Wilcox , Takashi Iwai , Hans de Goede , Mark Brown , Ranjani Sridharan , amadeuszx.slawinski@linux.intel.com, =?UTF-8?Q?P=C3=A9ter_Ujfalusi?= , Linux Kernel Mailing List X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Thu, Sep 1, 2022 at 8:40 PM Cezary Rojewski wrote: > > Add new helper function to allow for splitting specified user string > into a sequence of integers. Internally it makes use of get_options() so > the returned sequence contains the integers extracted plus an additional > element that begins the sequence and specifies the integers count. Thanks! In general it looks good to me, but a few minor comments below. ... > +int tokenize_user_input(const char __user *from, size_t count, int **tkns); Not sure how I can deduct from the name what function is actually doing. Suggested new name: int_array_parse_user(). int int_array_parse_user(const char __user *from, size_t count, int **array); (Note that we have _user suffix for many APIs in the kernel that does interact with user space memory) ... > + * @tkns: Returned pointer to sequence of integers array ... If you are okay with this, you may add my Reviewed-by: Andy Shevchenko -- With Best Regards, Andy Shevchenko