From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=198.175.65.13 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796252138; b=2gwxrLoiHoKYK++gwPkAmeIa+3ge+WCacD0edvA/iao8gpe3JPIKU3IwFvU0cDClyfR9 LJWmTVEuEsXktUUmZe7O0JMmGNXwxTkHxXrjLiaBs3j8VDeCOmYTDmLsiy1QlEcIUBnBl dDL7I6KYI05eLSihCTAHe15rNW3ZQ1pQ/GvNkA0V4M/jc4dPTZ5lr9aa83i5Hb1hykZCo nFrwu2vQRUHLOZhZqk9B9nrJtHPYSEbT3eGh3baHrgBLiw+v5Y1FKFf4Qebapt6R/x4i5 nil7SITdPYgFcd8v8ziiuVQfFK1af8tu/isCjJbEXipPuI9upqsmFe8o086enD/ujBg== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796252138; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:Received:Received: Received:Received:Received:Date:From:To:CC:Subject:Message-ID: References:Content-Type:Content-Disposition:In-Reply-To: X-ClientProxiedBy:MIME-Version:X-MS-PublicTrafficType: X-MS-TrafficTypeDiagnostic:X-MS-Office365-Filtering-Correlation-Id: X-MS-Exchange-SenderADCheck:X-MS-Exchange-AntiSpam-Relay: X-Microsoft-Antispam:X-Microsoft-Antispam-Message-Info: X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-Exchange-RoutingPolicyChecked: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-CrossTenant-Id:X-MS-Exchange-CrossTenant-MailboxType: X-MS-Exchange-CrossTenant-UserPrincipalName: X-MS-Exchange-Transport-CrossTenantHeadersStamped:X-OriginatorOrg; bh=4gBu4PFgdOy1wMOcDEFUjA8Lfucs+S7wAMyrk0oWfUM=; b=s0k4besVh8ieOpEci40LKS/o4f+hQdG6AQwZcIbWiu6EQHAuVZwh45HLYQ6ga8xV+HqJ AHHHiIXApM0eY7jGXV08tTNJgdj2r1zMdC4kc8HknOgXTvPeidp02hHX077ZEQgyP6wX5 VIeTYeF6MKA3WWtw5lJjKgnsUX2r7mdV/R+WYjSub3Z1OQJhvXaV4+YKI7qJ11I4ViXPo oco+urmYNlUsYK49Ii8DWNYTEmaiYyHi7nle66PYGpX2HcGbhm4Mq2j9kWjFByswZwkba lTF/ir0kbsFjVAahjxGiZ3r1ZPggWio+Ekn2V9gjD/X0ANBlzC4dkM0/xkw5pYKu9/Q== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=X5W1rgfr; arc=pass header.oldest-pass=0 smtp.remote-ip=198.175.65.13 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B7D0606A322 for ; Wed, 2 Dec 2026 22:55:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1B7D0606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=X5W1rgfr DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796252138; x=1827788138; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=4gBu4PFgdOy1wMOcDEFUjA8Lfucs+S7wAMyrk0oWfUM=; b=X5W1rgfrxSP1A9UIA95ZJDiP411q2cI8KRJvUO7cTV+MVl2G8vESx3A3 fZobafJi3i1a6/Yyx/WKvl/VtfHm7yCMFVq1XUqGJewOOTEwAP4D9ZTQ4 7U6m4ZFhgtjNdnQCZBgP6CdLPOn5tR0czrW8cVrLxGfTg6eZtrgDu/IZy 4AmY8osX0RZOF2ukSFxdMa+QcScqxSLdq0GF8vzNqEHoEAZRx3tFI+4TC hRpF009ZxXK6/Rx6hBCqbWcbx8U4HAsCzRdXqmhxviHD6UsOTJ0sr1c6I kwN0UeGZWFYCII++Vvk2DlVEotDp2afzGl9OXSDnqFRBMdwL3P2zxNIP6 g==; X-CSE-ConnectionGUID: YgOHxCJvSKm4YSU4f1RevA== X-CSE-MsgGUID: oMI7wdlRTiWcx1GdiCA1ZQ== X-IronPort-AV: E=McAfee;i="6800,10657,11984"; a="5103951" X-IronPort-AV: E=Sophos;i="6.27,247,1787036400"; d="scan'208";a="5103951" Received: from fmviesa012.fm.intel.com ([10.60.135.152]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2026 14:55:37 -0800 X-CSE-ConnectionGUID: Fi8dmTZvT4iz+GrjTfvnVg== X-CSE-MsgGUID: V8/GlgGUQHmGkB03nSz2Gw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,247,1787036400"; d="scan'208";a="15298565" Received: from fmsmsx901.amr.corp.intel.com ([10.18.126.90]) by fmviesa012.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2026 14:55:36 -0800 Received: from FMSMSX902.amr.corp.intel.com (10.18.126.91) by fmsmsx901.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Wed, 2 Dec 2026 14:55:36 -0800 Received: from fmsedg902.ED.cps.intel.com (10.1.192.144) by FMSMSX902.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57 via Frontend Transport; Wed, 2 Dec 2026 14:55:36 -0800 Received: from CH4PR04CU002.outbound.protection.outlook.com (40.107.201.1) by edgegateway.intel.com (192.55.55.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Wed, 2 Dec 2026 14:55:35 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lZ1l3N4j46Ycex3oHNCa703Ru+XSxudnQ4r23iul1okbKbp4JrHs8w7f7bVjz5jeV8PzxXGY9zCh5AsW29o2f4Evt/W7XXj7JU5UwwwPiOUCthxu86JbnX1e8DlkSW6UHTmm7OYgYmG06jvNMqFUqyryiZ8ZlX/8RQwDtOy1ld/MUo55nV74H55RiFxKaA+VXRrY+c1ZS0Qge8H3mFPODPwI17Wp2QcoSg1pxRlN2ZiqmhSgMmm8UimEybdTRa6P0dQJk0A5auNSqaUMxDIFFIBYv4Q/F3qwdSjTSIIxq1oZH4UJIUKubQ8BlEpN7otbhLv3sQqRPRUG0BzswSWTSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4gBu4PFgdOy1wMOcDEFUjA8Lfucs+S7wAMyrk0oWfUM=; b=PsYXu8ffsCova8latI1bKzTIF32lk4YmtIRwEoRtJPbBEtB8LmFnJ0i1YJATGCWMsG88etOYKekntn0hWD8pGwAii8rWe//h713m9rfE+0bF6wS2JOWE4hNdv11ST6SGp/bENqbrztagOMYK/X4MIxI1zjh7d8ir6+lRtWGsGrKErSdY4dcck6GgNMm0kXNs4LqwyHdw1mPaWON/pFnrp1p1P3LcqMZD/Q/yxCmP7ESAc408XlswiKWQ1UmTO4HG9eXnj/JvKU2Incn3reeQ2e0CRD0j0/U7kMBgyxvQV/rvdsCXON3Cr3tPqZcGlVS9i1J1DYJKmGK2qgpR6wwzxQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from IA4PR11MB8891.namprd11.prod.outlook.com (2603:10b6:208:56d::20) by DSWPR11MB9690.namprd11.prod.outlook.com (2603:10b6:8:356::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.10; Wed, 2 Dec 2026 22:55:33 +0000 Received: from IA4PR11MB8891.namprd11.prod.outlook.com ([fe80::1128:c90e:54:e8f1]) by IA4PR11MB8891.namprd11.prod.outlook.com ([fe80::1128:c90e:54:e8f1%4]) with mapi id 15.21.0688.009; Wed, 2 Dec 2026 22:55:33 +0000 Date: Wed, 2 Dec 2026 14:55:29 -0800 From: Alison Schofield To: CC: Dan Williams , Vishal Verma , Dave Jiang , Ira Weiny , , Subject: Re: [PATCH] libnvdimm/security: Reject security commands with missing key ids Message-ID: References: <20261201-kbug-l936-v1-1-a2e78263625c@gmail.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261201-kbug-l936-v1-1-a2e78263625c@gmail.com> X-ClientProxiedBy: MW4PR04CA0387.namprd04.prod.outlook.com (2603:10b6:303:81::32) To IA4PR11MB8891.namprd11.prod.outlook.com (2603:10b6:208:56d::20) X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA4PR11MB8891:EE_|DSWPR11MB9690:EE_ X-MS-Office365-Filtering-Correlation-Id: 2f3787a2-d126-453c-9dd4-08df50c75f18 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|23010399003|1800799024|376014|22082099003|18002099003|10067099003|261026140227099003|56012099006|261028144727099003|261022105027099003|261026121527099003|261021121427099003|261021130227099003|261022113327099003|261022075727099003|261021123027099003|261022115727099003|261102123227099003|261009223027099003|11063799006|6133799003|3023799007; X-Microsoft-Antispam-Message-Info: V3HDZ+JwUhxPMwXmoNjHnAffN2AFAr60YpxwXEpxc47kNzIfHMFN+K+km4htKt256nEWOd2VprnodiEWitrqHwDMT03yC+zkt8J6qCRga0fP4jmQItG7G+argMfR7eY6qovaSVQOAaX7qdewIXVeemWs7SfGH71acy3U0lmXqKB2a2uuXh9qWwrSrm60adSUxHnyld8GIPas5Ir/QQXOtbGQW5XBSMqdBMKSkzk7SHbwVOTVtg3AFp5e+8GMlDcGYnGXy166l/ujvQ9v52KNhnPbTfdo4H6JvF3UZXJeUOTEM4VD18chWp1Q2VvwnvO/liHDEvcvApjQjV0vcNHLdJfQ7aDpCPn9N15bedDrSvnagbvB/S2YCfkQ2p/0YTtZZjqlsoKGfdaxsKNw9xtP/TPKlTwCedAXEZcUXzVOK7ZscrQpeNoILCCRsU4Ds+lURyBxh6ZibfI+QK2eDTECNWng6VO1bNEg3ekbDma6S0jnnLRhXoGbCkUnyb17FxSy6YEv7yow/cVmjNhK4OfuLDdNl1kYyIsEH8eUYqCArLW7m2kj/rIC+V4tXH1bCtvizFA3zW3ESc1EnHHGeb45M0P2/xmU+p8BGqMxF7k50KoxL5XqDYVa+hbDy+xuh18HoBwl5gvjmO4/xi9rt3RzPBv+sL/eB7qwLfRTB451iRg= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:IA4PR11MB8891.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(23010399003)(1800799024)(376014)(22082099003)(18002099003)(10067099003)(261026140227099003)(56012099006)(261028144727099003)(261022105027099003)(261026121527099003)(261021121427099003)(261021130227099003)(261022113327099003)(261022075727099003)(261021123027099003)(261022115727099003)(261102123227099003)(261009223027099003)(11063799006)(6133799003)(3023799007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?OxuAhWsq3o4mTX5mS1R4uAD0ZCrp5fDscLq8YHNG6P7lW6I/+9SVGo+8CGeN?= =?us-ascii?Q?qlBksVjsNZ74RwMW/WvLba/QKAGVRF0rZHZB9pwFTle85dZj7X0i5jDXJRwd?= =?us-ascii?Q?du2rahC5gjSR3J5mU3G09EfQtdG+EMNuYNwivGhIinWwnou883A9UtdPi0yv?= =?us-ascii?Q?ugSnlZzz+7mJ3EUzsoxbfSuyJNRDXhevmdTrCruPX2JA4bkx4aIQ+l7bmj6g?= =?us-ascii?Q?GACBCxd+qwhnbutz0CpgdcJ7VCuctbUDhaYBilRlY01l5In2tzWZj307C6Gq?= =?us-ascii?Q?VwsG3FEg3KJnp6fAsxLaV839H6Irh3EO6ftG4Mv4gKUM2zyLt+GoyOnkHvKC?= =?us-ascii?Q?3N9zM8SkOXTENyaBML+NFXHKe47TRv3mHoN5ge4yCbfhqsZyfDV2AQJZAGXv?= =?us-ascii?Q?brI0Uu+JxvlBlQ4Z2PwhXSkyo7uatN17EQ3TnHjYw9MpBPPiaJSkn2gGLwY2?= =?us-ascii?Q?4hU+FLgLcJJzCCCDWz8bFgyuPj1VNRiulJxH6yOFqAH3KCABW/fyf0htQO6J?= =?us-ascii?Q?80jF2oJ2+97CFy1hZSldEak4fU99g7tAUvXMmdmu0629Cl5DbOHF9hIGXdj8?= =?us-ascii?Q?kE/58Pm7PpwTd6B+I7nD5nR2KIsvXII5fbGykGP6wOtpJqoxdp/Q6/N8a7/A?= =?us-ascii?Q?twNfo25hhbbyQTFsAwMLLssi1E1+sA4m+wIQeKQErLoLyD2eA7v7YY09XvVz?= =?us-ascii?Q?e+k1kIJjASyZRosJiuU7430DnEKauv3s3+OBHhewCCiBjHTyIfs7qobr658u?= =?us-ascii?Q?M3RCkc/jdcVZq2Z3W6Hj89bLuJjXibkVB5BtwW/DkGvTVtrAkU7lcLW3y/Iy?= =?us-ascii?Q?CswIO7e8tP458aoL6A1psoD+gvY7iAWRYSxtRvLZrqDpX8wxSqRotRRz2QtW?= =?us-ascii?Q?bYp48eYFygKyR51d1fmztU8k4AHqrluUPhSwz+n51klQFsX2YZE6k03HOcur?= =?us-ascii?Q?ICnK881X55WSJ5xEM8Lw2AZzPge3vlawDGY8J866Amb4W5cYGw0EqHrBfyjM?= =?us-ascii?Q?z4nRz1gD4zWOKsg+mwD9m3XLSIdQXdY8ykP7pvXniNW5nw1lOFaqrT10J6eP?= =?us-ascii?Q?d/i2LYOmFO9RcDdDQnfrQ6xls+DtVpPCbmNdiMp56Wo6KjjjbjFR/yaEyWdt?= =?us-ascii?Q?lZ4XR1+OLhMp/FRoSxjhiBx3uK26M3oWJ/zl7H4HxirGuqHv32KRfqkqYcpO?= =?us-ascii?Q?k8rNoYvHHtMKrZ852ZzyRu6i20vo66KfYSpxRjXgD9MDrCQ3dFyK2xnvTsM4?= =?us-ascii?Q?LOUXFUJHFQnbMKQLJHNiN72IkZ+1vkI874JTumGk8xa8suumYRUGPYnBsot4?= =?us-ascii?Q?TNsIkd7QviMu3hONVl4fNdPN+8nSpuO/u0kIM0Dd1yDr46i775DXj3dDF0iB?= =?us-ascii?Q?vCbvvWqUrHjkikBwHXXm9XwiS6pBkwifEQP1rdwZGgW1cyaCAz/OVwKyskd7?= =?us-ascii?Q?GPuLsBtYvIlB7U23ygCaYQJWlqgKqGe3zOjzUM6Hq+Yfh3c079kjW3IlnjmZ?= =?us-ascii?Q?bN+/LgQ79SR+RW2NX/7sZvzLcn3uYWmrpzgirv9QXeWaTcoKR69Ei9mGFkvf?= =?us-ascii?Q?HLlzMckihIbnp8QYeEtQWdeGfS9F9/UPcTW9HgT9JqXdsBnxogQo6EnKL9CE?= =?us-ascii?Q?3oCOPpw/pm+GiOfZIs4iPeiyZdPLsjE4h8ZKdQLuLFmsprxEqqyALjNmMneS?= =?us-ascii?Q?4hNkW9onZ8y4VaOOF4RJQyCkay0LUEf83VjwKoFrvqGhKWxJl/hDc/fdaEGk?= =?us-ascii?Q?epSniBfEmCDeoIgHi4LpLYNcsDhQS2Y=3D?= X-Exchange-RoutingPolicyChecked: Yr0SkoVIA+YvFeJ1fSBa7ywSDH7z4GyYF3DqBT0qobWYYo2Fhrk37Jz3Ce9rnlH+uOahTiHznd6ysi+WsA/AE53v5wgmg5gaSfdiffclm59P3xbYw4xQF92RkjYOaY49AKNmQX97WEuv0rFvBvzxZeb7PvTMcdrMnVOd6lzCLPr5BVylICyJ46F/AsAiJbdFlrxudKe7HWhEhgMyRcYgIX/jVOym9pvb41HIF4viK+vVlg5WdkUGRr0OatNyvCls925HVsGISTgevZH+3p6Pfed2+w4mskk3zmtvCnZ1GRB+apQ8SP3fa8CDQB98MFhcXscappnBFHfRgg8m9dV7Jg== X-MS-Exchange-CrossTenant-Network-Message-Id: 2f3787a2-d126-453c-9dd4-08df50c75f18 X-MS-Exchange-CrossTenant-AuthSource: IA4PR11MB8891.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2026 22:55:33.6003 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ucMX4kQbb2AaF9I5P+H7QvPjD1sEnRYGvgM5ceQ2u/HdmMKVx6i0WzprgeeP6sqhS0JcBrRgE3Y3tyW3HvLJD6GfJ0WM24u/iMzVoem7EVs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DSWPR11MB9690 X-OriginatorOrg: intel.com On Tue, Dec 01, 2026 at 09:16:27PM -0600, Zijie Zhao via B4 Relay wrote: > From: Zijie Zhao > > nvdimm_security_store() parses the 'security' attribute with sscanf() > into the uninitialized stack arrays cmd, keystr and nkeystr, but only > rejects a return value below 1. Commands that take key ids are then > parsed with kstrtouint() on keystr and nkeystr according to > ops[i].args, regardless of how many fields sscanf() actually filled. Hi Zijie, Thanks for catching the missing argument check. I'm going to NAK this because it seems to be simply a forward of a static checker result without the needed human effort added. See below... > > Writing e.g. "disable" without a key id, or "update 1" without the new > key id, makes kstrtouint() parse uninitialized stack memory that is not > guaranteed to be NUL terminated within the array. If that memory parses > as a number, a key id taken from stale stack contents is passed to the > security operation handler instead of the write failing with -EINVAL, > and the handler proceeds if its state and key checks succeed. This depends on the kernel configuration. With CONFIG_INIT_STACK_ALL_ZERO, the missing key ID buffer is zeroed, kstrtouint() sees an empty string, and the write already fails with -EINVAL. Also, ndctl supplies the required key IDs, so the case described here is a malformed privileged write directly to the sysfs attribute. Please rewrite the commit message to explain that context, the expected behavior, and the impact on affected kernels. Say what you observed at runtime and which effects you inferred from the code. Please name the analysis tool and only summarize what it reported. > > Return -EINVAL when sscanf() converted fewer fields than the matched > command requires. > > Found by a static analysis tool. > > The fix and this changelog were drafted with AI assistance (Claude Code, > with a second review by OpenAI Codex), then reviewed by the submitter. > > Fixes: 03b65b22ada8 ("acpi/nfit, libnvdimm: Add disable passphrase support to Intel nvdimm.") > Signed-off-by: Zijie Zhao > --- > Testing: > - Compile-tested on x86_64 (allmodconfig, W=1): > drivers/nvdimm/security.o; no new warnings. > - checkpatch.pl --strict: no errors or warnings. The existing ndctl security tests send complete commands through ndctl, so they miss the short-write path. I expect a regression test to accompany this fix. Please add a case that writes directly to the security attribute, checks for EINVAL when a required key ID is missing, and verifies that the security state is unchanged. If you're unable to reproduce the problem or run the ndctl security tests, please say so explicitly in v2 and describe what you were able to verify. If you plan to continue contributing to libnvdimm, I encourage you to get the nfit_test setup running and learn to use the ndctl test suite. Being able to exercise these paths is part of validating fixes in this subsystem. > --- > drivers/nvdimm/security.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/nvdimm/security.c b/drivers/nvdimm/security.c > index e41f6951ca0f..1fc6c0ad1460 100644 > --- a/drivers/nvdimm/security.c > +++ b/drivers/nvdimm/security.c > @@ -534,6 +534,8 @@ ssize_t nvdimm_security_store(struct device *dev, const char *buf, size_t len) > break; > if (i >= ARRAY_SIZE(ops)) > return -EINVAL; > + if (rc < ops[i].args) > + return -EINVAL; This checks the number of conversions, but that count doesn't establish that the input contained the required tokens. A width-limited %s can consume part of an overlong key ID, and the next conversion can pick up the rest as a second ID. The parser also ignores extra fields. Please account for both cases in v2 and explain which malformed inputs the patch is intended to reject. In particular, the field count alone doesn't catch a missing second ID when the first token is split. -- Alison > if (ops[i].args > 1) > rc = kstrtouint(keystr, 0, &key); > if (rc >= 0 && ops[i].args > 2) > > --- > base-commit: 5a277aa7eb4d4f1f05534d6c3dcb1a9fa4f6b8f2 > change-id: 20261201-kbug-l936-0b24cea11668 > > Best regards, > -- > Zijie Zhao > >