From patchwork Tue Jan 23 15:02:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 190992 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp393816dyi; Tue, 23 Jan 2024 07:04:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IGj6r7c+3OJgDGP8q0pE/RJ2p8SOweNBYRXZUkWqvqntIIsEcOh7D2Q8P7j/VwBIQpKB74o X-Received: by 2002:a05:6214:2aa6:b0:686:a15c:4e28 with SMTP id js6-20020a0562142aa600b00686a15c4e28mr901392qvb.49.1706022287076; Tue, 23 Jan 2024 07:04:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706022287; cv=pass; d=google.com; s=arc-20160816; b=fdG+0Pl9/RCrWC1jkvte5gyRG1pFBUwWRZeSUmtyujcOyZIG7meyQD92b4tBdIqEf2 Sk6awuMw2ug6p/GWequ4QXk5rl3JObwD9n+QYjlBSYRnrLb2Uz9+Hc00IKPCaMz7n4z8 uyjSuDuhfRnntrYI3h8Xct7TV+O8R8gLntEcvnQTYLoXKjZC4pAZO0vbFScwNXgffIAu YUacvY7gOmNfdQmjfNV2FtcWSJDbMe8l+7ZFSUFffo2oX6YTMOohSahPYoArcd786rAA rXK5+0vJ8TcufEHFwdAxUf6JQOp3QXS+q2sTYmimQeef/TVqjGR9tqmi5+DBL0LnmqDw AABw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=osFI0XBBw/tiCFbgwkuDIcSq32WCfyKmLidaivpknYk=; fh=LBIueuLWJJWHxyU4hm5JIqvIjL/4JP6mHBzM9UMkE+w=; b=nGdSuwzBRQ0e4uWtHcR++UOTUWN+80p4p6PJYAV8k/gViOsHM2xCk+JX3k7x+0UuhI sZCSKAN9u768kGx7Z4F8rq7yIb1Ov8iDsMyLlWr6eGVq2SWKPCyG6nRZGBg6diGYMQpf ixVvm6oHtMfWtbosvEE5Osox6o4MC6eRNgGOPVTm6O9vBr95SAig/yoaISyMfYwzQ6S+ s1f0f9yEtHAf4+jI7MTPkVtGiktPIbcUTPfxxuGFJkKAkOcRhaqoz2Hw0xIS493EHUjk tvROE5TJnf5/vNdryJYqXZNlxn8SPWwylInraT2fVsraebPjRlLDskPTnR+XP3UGhrte gIfw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qWXfw0+m; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-35493-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35493-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id l11-20020ad44bcb000000b0068565df363fsi7772293qvw.36.2024.01.23.07.04.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 07:04:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35493-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qWXfw0+m; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-35493-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35493-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 5AF481C27792 for ; Tue, 23 Jan 2024 15:04:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9129160246; Tue, 23 Jan 2024 15:02:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qWXfw0+m" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E97E85FF0B; Tue, 23 Jan 2024 15:02:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706022177; cv=none; b=qLuXAcajt4uRIpnSLbXGhzyLHpjdDoU+BNi6DdedgPoIu4D+GXvLmxmJzZwDkoBl8gb+KcrRJLoKn2ocLJ/VeF6SelLK0S1b7P6uVaF5lKAv/r77YqB0M4Dvf7At/A646WLRMRLyLFm4KIJPleIi3di7xGRWO9YEquiup73+s80= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706022177; c=relaxed/simple; bh=zdIHKJVOlplezFr0uz3PNofWQ1uhtB4tw/QWhytbAQk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=FECqxt4h4dwXH5h0aGJhbuldcbaEMQdITipSaOx5YtLledC3z7USF1mgIpQfYZk8/Fdf9VrB3eL2tw36zubBqVIUCVBf6vC/3r9dT06hIyVNcErWc05S6LpWl83H0I6bMnIfU+0uXPZDn9Eyztj7/HLZ0xqzdhEm2IT7QCQSdRw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qWXfw0+m; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA37FC433C7; Tue, 23 Jan 2024 15:02:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706022176; bh=zdIHKJVOlplezFr0uz3PNofWQ1uhtB4tw/QWhytbAQk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qWXfw0+m789NUxJmtFrZvrkib8DMiUt8NyTKfxFF0Yor0xtJGY7k55Rm1Q/f5DMyn P0RTEYUHv0QVfup33NpQy1wz7KMJ8YcNd8f9q97eq3J5KeEsikQxot0R4WnjBZHUES hTcbfS906sG5fRZNmUpf7OKjKdQNIVdCjt/TeyAE57qmPq+A5VaCOXzR8GePKvA22A +musBmzF1RF2bz3u2tTF6MJXc4QUWhjHmmlpnNyXUUYvyT8KeedkpCIweoOwh4WW88 jALbfw4WghV19lx/EQd9lYDnB0uBRuTKC/nPjWaqBwhV9/HqCWpOrhVpaCUN5p7yT0 gn1A9FtZm6AXg== From: "Masami Hiramatsu (Google)" To: Steven Rostedt Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] tracing/probes: Fix to show a parse error for bad type for $comm Date: Wed, 24 Jan 2024 00:02:34 +0900 Message-Id: <170602215411.215583.2238016352271091852.stgit@devnote2> X-Mailer: git-send-email 2.34.1 In-Reply-To: <170602214309.215583.16731124846112910621.stgit@devnote2> References: <170602214309.215583.16731124846112910621.stgit@devnote2> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788894025455911512 X-GMAIL-MSGID: 1788894025455911512 From: Masami Hiramatsu (Google) Fix to show a parse error for bad type (non-string) for $comm/$COMM and immediate-string. With this fix, error_log file shows appropriate error message as below. /sys/kernel/tracing # echo 'p vfs_read $comm:u32' >> kprobe_events sh: write error: Invalid argument /sys/kernel/tracing # echo 'p vfs_read \"hoge":u32' >> kprobe_events sh: write error: Invalid argument /sys/kernel/tracing # cat error_log [ 30.144183] trace_kprobe: error: $comm and immediate-string only accepts string type Command: p vfs_read $comm:u32 ^ [ 62.618500] trace_kprobe: error: $comm and immediate-string only accepts string type Command: p vfs_read \"hoge":u32 ^ Fixes: 3dd1f7f24f8c ("tracing: probeevent: Fix to make the type of $comm string") Cc: stable@vger.kernel.org Signed-off-by: Masami Hiramatsu (Google) --- kernel/trace/trace_probe.c | 7 +++++-- kernel/trace/trace_probe.h | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c index 4dc74d73fc1d..c6da5923e5b9 100644 --- a/kernel/trace/trace_probe.c +++ b/kernel/trace/trace_probe.c @@ -1159,9 +1159,12 @@ static int traceprobe_parse_probe_arg_body(const char *argv, ssize_t *size, if (!(ctx->flags & TPARG_FL_TEVENT) && (strcmp(arg, "$comm") == 0 || strcmp(arg, "$COMM") == 0 || strncmp(arg, "\\\"", 2) == 0)) { - /* The type of $comm must be "string", and not an array. */ - if (parg->count || (t && strcmp(t, "string"))) + /* The type of $comm must be "string", and not an array type. */ + if (parg->count || (t && strcmp(t, "string"))) { + trace_probe_log_err(ctx->offset + (t ? (t - arg) : 0), + NEED_STRING_TYPE); goto out; + } parg->type = find_fetch_type("string", ctx->flags); } else parg->type = find_fetch_type(t, ctx->flags); diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h index 850d9ecb6765..c1877d018269 100644 --- a/kernel/trace/trace_probe.h +++ b/kernel/trace/trace_probe.h @@ -515,7 +515,8 @@ extern int traceprobe_define_arg_fields(struct trace_event_call *event_call, C(BAD_HYPHEN, "Failed to parse single hyphen. Forgot '>'?"), \ C(NO_BTF_FIELD, "This field is not found."), \ C(BAD_BTF_TID, "Failed to get BTF type info."),\ - C(BAD_TYPE4STR, "This type does not fit for string."), + C(BAD_TYPE4STR, "This type does not fit for string."),\ + C(NEED_STRING_TYPE, "$comm and immediate-string only accepts string type"), #undef C #define C(a, b) TP_ERR_##a From patchwork Tue Jan 23 15:03:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 190996 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp396353dyi; Tue, 23 Jan 2024 07:07:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IEkh0J7wfFk9Mjd08/wQrc5l4zVvUDRZ7NgOpsJzFtdTvidpfpWM8CF3pvknePX7BaNWzIN X-Received: by 2002:a17:903:228b:b0:1d7:4c27:8c09 with SMTP id b11-20020a170903228b00b001d74c278c09mr2756408plh.127.1706022463619; Tue, 23 Jan 2024 07:07:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706022463; cv=pass; d=google.com; s=arc-20160816; b=0LTWPidd5Ylldj07YvanCGDwXuTHRh8MdEI70Zx/jwxg0TmNsmpajTmitFpRYWVYy0 vYY1Kmecx+awnwfdsC/kznXb0ePKe8kUzjsHs05SHmYSeo7/1ZxBal95VQnsqc2rj9B7 iVSfZs91mDdx2vzkYqLbzLtkV+rALjcwCiEEibTHK0SQSdi9SjmcMhMJ9nu5ER5H8iIr bm2JyiA2CX6cjbFkDyfNMD/j2l0+sJWkhcItTsRmM5WVSiWSqyzhO2d0DP/FPkXlSj+m xLLeAyDIzZcHvERYL3WefYdounTN6MZFUm88J0+PsT3nIxc1EAg+6oaJI2FaunenAWCY d16w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=Lx92Plo1fDxFp6mOe4BmAYC2z1sYcgBI6uW2nCOBopc=; fh=LBIueuLWJJWHxyU4hm5JIqvIjL/4JP6mHBzM9UMkE+w=; b=hAfQj0AfIup19ZY0TB2nRGJjTgoMzEBAKgJCyuis3FZBuBHiqiqlMX9swiGTeVUUbm sQfQ5jAzbqbAYgDQz4ZkpAjs6hQqMpjAIBUCcV+HwkEGDw9FK9ML6VEEH011EKzfWSg6 CqSlz+oETF+MpD6pji2stcZ0qj0yXpOZnKS6eIfys1PQ3bIoQHNLxNs+jkPva8OvKCng nv4YTlh+Tg8gjhe16n96XVg2CfFOsuwNxezyZT0nAk8uKg3Ugz+lVm1j0lbmPkE9vryz dLkZD7KQqCal4j8m1LAJ8sPsWnSjGU/8caM8TQdQBR/88Ct3aXIL+/Ne9cgJIbviLYrg Ov7g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MNjIOkfD; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-35495-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35495-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id j8-20020a170903024800b001d6f7879b34si10210005plh.383.2024.01.23.07.07.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 07:07:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35495-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MNjIOkfD; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-35495-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35495-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E0148290A82 for ; Tue, 23 Jan 2024 15:04:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A8DE2604B1; Tue, 23 Jan 2024 15:03:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MNjIOkfD" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 103CA6025A; Tue, 23 Jan 2024 15:03:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706022186; cv=none; b=k1JMIe8X33pn2NRv2DWNncVdF8ndRj7MHD15fPM/iSSWXv1JOYmnKv97EYBdKkelyd1B439DFZ0S6b047fnztxpTNaT4KmkoBLEuhgF5dADmj57yxR2NGATDpUVK8e/wuazBqrPlKyC6eQjE1+SNN5k+JKUp3JFMT0LLZHX0W70= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706022186; c=relaxed/simple; bh=DpFRKAv848BeIsEakfLzG1UGGofnWebodFFq+ZPLFzc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=I3xt35VktEDTD1sT9biavm2dw2O15vv/FZUZKI2qfNs03JUIE/C7Cl09OVMzWbnKOn2cKTtV18RSaSxTzoF5ujA6NGJ8ihdExvMiezgiSKnHUQjvQG0wvO3INPR/HitIYqMQHFlmFjd6sxp/rgEhLTQ1huW3Bvjrg3QuTcXO8i0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MNjIOkfD; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94777C433B2; Tue, 23 Jan 2024 15:03:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706022185; bh=DpFRKAv848BeIsEakfLzG1UGGofnWebodFFq+ZPLFzc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MNjIOkfDtBPT8jY8NxQen69zTiSHDSrOVlENvRZEsyBxDj/tqwpecSTTDlPGvwiqj CaEmyHGdx4QSwezjaYOSd2J7TrovAkX+KIwwVZ8YtH51JGB3jlT7zG2AB0O69y0itU 1F9jk7tbibrLFv2f9Q0eWt2Ymq16yKwws2VuTLBDEZRqjoWUbu/kzjI3Q6YpN5sbDU MZT/yiiJ67R92QjBF1Ru+BRtxKk0gtWyteKgcS8MNJR2AEaiLDBMjcz+pLSHWVzuKq IwVYlhRKQlu7B7QU698fY66kJNumSkY3PnDNgrJX4pS+qdEFUCkqdBEnAam2771XhQ JsuVUz2gljaNA== From: "Masami Hiramatsu (Google)" To: Steven Rostedt Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] tracing/probes: Fix to set arg size and fmt after setting type from BTF Date: Wed, 24 Jan 2024 00:03:02 +0900 Message-Id: <170602218196.215583.6417859469540955777.stgit@devnote2> X-Mailer: git-send-email 2.34.1 In-Reply-To: <170602214309.215583.16731124846112910621.stgit@devnote2> References: <170602214309.215583.16731124846112910621.stgit@devnote2> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788894210890206859 X-GMAIL-MSGID: 1788894210890206859 From: Masami Hiramatsu (Google) Since the BTF type setting updates probe_arg::type, the type size calculation and setting print-fmt should be done after that. Without this fix, the argument size and print-fmt can be wrong. Fixes: b576e09701c7 ("tracing/probes: Support function parameters if BTF is available") Cc: stable@vger.kernel.org Signed-off-by: Masami Hiramatsu (Google) --- kernel/trace/trace_probe.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c index c6da5923e5b9..34289f9c6707 100644 --- a/kernel/trace/trace_probe.c +++ b/kernel/trace/trace_probe.c @@ -1172,18 +1172,6 @@ static int traceprobe_parse_probe_arg_body(const char *argv, ssize_t *size, trace_probe_log_err(ctx->offset + (t ? (t - arg) : 0), BAD_TYPE); goto out; } - parg->offset = *size; - *size += parg->type->size * (parg->count ?: 1); - - ret = -ENOMEM; - if (parg->count) { - len = strlen(parg->type->fmttype) + 6; - parg->fmt = kmalloc(len, GFP_KERNEL); - if (!parg->fmt) - goto out; - snprintf(parg->fmt, len, "%s[%d]", parg->type->fmttype, - parg->count); - } code = tmp = kcalloc(FETCH_INSN_MAX, sizeof(*code), GFP_KERNEL); if (!code) @@ -1207,6 +1195,19 @@ static int traceprobe_parse_probe_arg_body(const char *argv, ssize_t *size, goto fail; } } + parg->offset = *size; + *size += parg->type->size * (parg->count ?: 1); + + if (parg->count) { + len = strlen(parg->type->fmttype) + 6; + parg->fmt = kmalloc(len, GFP_KERNEL); + if (!parg->fmt) { + ret = -ENOMEM; + goto out; + } + snprintf(parg->fmt, len, "%s[%d]", parg->type->fmttype, + parg->count); + } ret = -EINVAL; /* Store operation */