From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1ECF2332EC6 for ; Tue, 25 Nov 2025 18:59:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764097177; cv=none; b=E/Yzh+QlsBKLrMLya9hOJHyzVp8XqOPy+jE6VTJSbDrB9NMhoefG9ymr1brckry1ElgU4axcjyyPeglPhINOPpALP/MPfVCFGLF5aBmDyD6heVCojhKvz1SuiQmig8IMCRXYcZIZ45eCSiKkpmEUClfmxtRHqZsiHUBW9NftZo0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764097177; c=relaxed/simple; bh=yOFucbp8qhMoIw4wLHpUT/X36VLPm5l//pIaGkCFQlM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ST3rJ4okBTEsi2qU7kaDBCmlJKhhMsSqdBTXmg4I8zrre6rnxwXSbAI+5P9Z+CBYDwNn0USoKKgLzW70TWw6Hl9Oq4fFqiSJh664DhHaGXfhOnYpItHi0+JdO10kjMwEDPtQG3jToEtVjF5lrCuJGYfzCrLUPfv1bpzirAK7hr0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=fbXAotmH; arc=none smtp.client-ip=209.85.128.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="fbXAotmH" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-477a219dbcaso53089085e9.3 for ; Tue, 25 Nov 2025 10:59:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764097173; x=1764701973; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=jmBPXp4FX8VWv8A/1xzlTIxHcprYvbnP+acWiPY5y1E=; b=fbXAotmHJzXgQSEsgW+pJhTBf0VTk25s9Pbubk/fe2wjlSe0WZ6bN8Sai+3yDW4mtb kbRPdtWiwhSrQ3GKQ6OPMTapkKyoNyySoobjZ5HVjFsc8gmdMGe7/l2fzS+7VWwXnKvH iFfAz05oe2TqwV/pN42aRk0KrILZtugLiIp/Xw85HDb/9jUQgn0g+2gN2N74VSYW9vw4 wciQv5i/Zzvz+wyIJ/LypuNzf9mg9Q7sBHmNgk9aqoQBlS2jBQEFM3gaFq0QuWGLKbxE jG9+wLXUJpR+c6YpBsSy5tUduoTs2Df5Se6l2rxg0JmYkc96H1BADpNtnmP/L2aeB5bD K4jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764097173; x=1764701973; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jmBPXp4FX8VWv8A/1xzlTIxHcprYvbnP+acWiPY5y1E=; b=dWFYd4IWF6kVMvXNzmpEbAX4YMbmUtLKkEEDly7HzBwLZwgie7U3jOuaAPDVk1Xu8G 3SMhCfXvCCi6ck+FVg8eD8zjrm30NJTsrkdEQJgdXjoW19BHlpykSPCjaoJq44c3keEG oNZQWFV47VtIY1bZG1MUHN4OULUMzmsHNlwEv+Z99yaUzxAqFY6lbR4mA72h4nBl0293 Y4LqZNUwAO7DI7ljszkviFcPATxtAzQyVZO/LlswJG5UrAQRw6n3eiMIBt/fwkSmiPLE 04s2R6jG+iv45eLVjHerAlbQyBpPPLUDgug7LJ2Syd96TALLnisgXo8pJwCOjaCtJfWa /lpQ== X-Forwarded-Encrypted: i=1; AJvYcCVZdM0BS0kGd0Z93PkkF6WbdemcJaVWcCUVTnUzhtRNFvKhiuqsFTy7KDG4dfUJd3ArfbciaKmy0pf3+MY=@vger.kernel.org X-Gm-Message-State: AOJu0YxsoS/8bsfklF5w0pfytHIucQqIkWBs2LKyEJemWVKOMLzbzGKi 6okLOvMTxzXxGRSpCK6rmIE63k9Wy0L6ZaUvofjyWD+92KG4Vhkl4DlNPuxTBJb4ORM= X-Gm-Gg: ASbGncvDmZB5hOBO8J5V3DasWtXS36zrPPLMlrkhFzDnuhRTBj9q0S3atjclaBIKBJJ r5OKJOZPRQOOL+OroeHcVmVqRfrhiYqSyEJjwDpq7ZqzDWSxtXi5epPCaeRKL2Zza2+0YguGvBJ h4k0KgkCaHfBRdSbvukK8unTcf388kJdsHDKMkwJhSR2Wf4FFGcMqlZ2LHhXuPkSiiPZglUSNFC U39v5HqwZhM/XfckPw1QYRNW1+VGzhq66DYxRizPmBKqaDh0+xtTItWVEPLkWyvpMMaEFstNnh+ SiroOItcwHWrZYZpDAADe3RgSU9CVyyxk25psO4k6N2ePCaNb1LSOo3gykpKNMnB31A0YVtI0G1 tX0zzgK6xfo6IspiYEsUjU0Ua67Zo/j2zGJ6tfrGPuM+IoupYWrD2kPWQtagu5oU6tccTirG0op Yuu4zOwBdgqPUlaVJW X-Google-Smtp-Source: AGHT+IHwbKRr1pvKyNsFNGaFEvgiVnbE4yxn0br2mGaIpqkjm2b1jEyBexkRR5mnkMzoGLfDWc+rGg== X-Received: by 2002:a05:600c:46cc:b0:477:7b16:5fb1 with SMTP id 5b1f17b1804b1-477c0174856mr167233485e9.7.1764097173292; Tue, 25 Nov 2025 10:59:33 -0800 (PST) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-4790add4b46sm4117085e9.4.2025.11.25.10.59.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Nov 2025 10:59:32 -0800 (PST) Date: Tue, 25 Nov 2025 21:59:29 +0300 From: Dan Carpenter To: Ira Weiny Cc: Mike Rapoport , Dan Williams , Vishal Verma , Dave Jiang , nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH next] nvdimm: Prevent integer overflow in ramdax_get_config_data() Message-ID: References: <6925db85a9343_63977100fd@iweiny-mobl.notmuch> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6925db85a9343_63977100fd@iweiny-mobl.notmuch> On Tue, Nov 25, 2025 at 10:38:29AM -0600, Ira Weiny wrote: > Dan Carpenter wrote: > > The "cmd->in_offset" variable comes from the user via the __nd_ioctl() > > function. The problem is that the "cmd->in_offset + cmd->in_length" > > addition could have an integer wrapping issue if cmd->in_offset is close > > to UINT_MAX . The "cmd->in_length" variable has been capped, but the > > "cmd->in_offset" variable has not. Both of these variables are type u32. > > Does ramdax_set_config_data() also need this? Yes. It does. These are from Smatch warnings, right. They take a few rebuilds for the taint information to propagate from the ioctl to the ramdax_get_config_data() function. When I rebuilt it, then it propagates to both so I would have seen the ramdax_set_config_data() tomorrow. But they're called from the same function so the taint data should have propagated to both at the same time... WTF? I don't know what happened. Anyway, I will fix that and resend. Thanks for noticing. > I'm not quite following where in_length is capped so I'm inclined to > add size_add in both set and get. I meant that the if (struct_size(cmd, in_buf, cmd->in_length) > buf_len) line checks that cmd->in_length is okay. regards, dan carpenter