Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp159117lqc; Thu, 7 Mar 2024 13:20:15 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUmPyUYmoiQfrcgQ8s0gED/UFjXKewdSHgKtZfDhU6O7AdDuAFKAutwYSD44pdx+qETCF/ky70DKGdctXlBQRYX/ftTpybxJdyM4BgVlw== X-Google-Smtp-Source: AGHT+IFib2twx0+2+A6X9tjrBqP8qAvuzftvRQQQT30d3CFVOofebpCD2tLtsxpH3glrid3oAcwF X-Received: by 2002:a17:906:16c7:b0:a44:d498:c6b8 with SMTP id t7-20020a17090616c700b00a44d498c6b8mr11578638ejd.40.1709846415400; Thu, 07 Mar 2024 13:20:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709846415; cv=pass; d=google.com; s=arc-20160816; b=Xt6p5phxAIuyQFAPoiPiCcBuTaVHUKgoCQOu9qAtyAAf6yKdupcZ/cX+RWcWGxbvvk mznHc4DyaAHSMcc8XkH/23vlFbLBoGktw46Nc+vneKtFljY/nzdmplIo86T6M+EwQpAp a1v9xOo86oB9GKsfOjssVlUTEli6sZFx6LHmHrwS1Hd3EbCgBifsZsCHzubtGJh6hjJZ 5yMxLh9BTPAZMtHzbtPr38EyiPfzCdGgt4FOADCCPCXzESuKjVmpRZEBmiy+eQrv1m5c Tc0D6ygkTWNIjXfOjZStdRN6w75Jr5aPQXy0qGhLqvJzO8MT1i4CXKiIGFUr75E88Lo3 JvUQ== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=FxAW6z2fWfFSrmQ+Ro+a/GGTy69KREURq9bDQwEnpUQ=; fh=xi0ipXnwWglsxDeKcFyQrszhaaiVKmSvtO8a3wy6VVg=; b=HV7kbXUKvgAk7qxE+8wDKkETCJJ2IztUW/3VGKvHsoynW4p8780AvkMi9oBE/1YM8j trxzC/zunYgbNBnZgs3iusuMhsng/mrd6eT7jDmz5K821dGdA4Mzjfxa3aLoocZwqvRg thZsfUPHCHwVfVFRaaeZmDkuEfIfFqudPY/8QrP86V9WEM3cDHnTCAs0YKq56wbe/o7K sN4jYNv84xn6Up6eqs34hwuLagXwZsJMdiRIcgJa4i6Nkl1bSe8DUL+dIxQft24Uzkem mWjrI3uK1Jhrf2iDdkrM1Bq3kCh//bijjO1gKXo242/jfFBgcTpuI25FxaUreX+O0o0W vs+g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=mzfx1bGr; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-wireless+bounces-4474-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4474-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id gt16-20020a1709072d9000b00a444e66e76bsi7179435ejc.639.2024.03.07.13.20.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 13:20:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-4474-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=mzfx1bGr; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-wireless+bounces-4474-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4474-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id F118A1F23026 for ; Thu, 7 Mar 2024 21:20:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D857E13AA2D; Thu, 7 Mar 2024 21:20:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mzfx1bGr" X-Original-To: linux-wireless@vger.kernel.org Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) (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 08F1F20B38; Thu, 7 Mar 2024 21:20:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709846405; cv=none; b=qVidbC0ycN7l8Fr3vB1s+dGRFn2Fqg5Jxuu4imlyypYtZz7QzOINbHTq58p9ItBSn/247Q1ogZNJgEMqfqEsIWzf2zxvOsC8K3kW4mJl+HHEjjBPGzNQdMztAJ0ANA+xWiyXDNgdBD1KzSHb5yVMmC8m0UkKX8cMuhbZ1kzIFQ8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709846405; c=relaxed/simple; bh=xdHld3fsdtPljdPCL66D7ZTvMhGAvf9JeorKbStlTFc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=fSnBsd5EPVmanC3THMK9A9Mu+kRguFFXyRky6O/srSLhFr4RF1riRXTYjioyfsTn0nvGO4PX67ewLf8oLUGz89Rk4YvmcGypNXZhknIARqXDCCirymf3yrOCtSeN5De/LVakiEQgVA/8n/0OTmVDDacxi9mCemCqn3QFBmsUV34= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=mzfx1bGr; arc=none smtp.client-ip=209.85.208.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-2d2ab9c5e83so12647021fa.2; Thu, 07 Mar 2024 13:20:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709846402; x=1710451202; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FxAW6z2fWfFSrmQ+Ro+a/GGTy69KREURq9bDQwEnpUQ=; b=mzfx1bGrhYz2GwofGg1ERFd0Fp9t9E+3F1285u5KQR8S5DyYRblfOcJddEVu9C5KuQ SUclPS89Snducnc6TxjDqpz7H76GzF8WvLvBUWdjxLViqkxRiAIK4l9zCqTDF8S3W+oa rpkR24oXir0u24ajeXWqbQLQjzj3YVhIIlvQ+P7PCPFlHS1eofveYkQDTvBe7sZMmm8B qam+CtKcDUOk6NXY6IacmAMXV0H28NfttQwjkxfoAX7x1iP7Hup9pT3JMX1tYhv2eT0Y hQ1XAYakkNpi2HRUfBT3xTQeJGWnCcSeCLME1YhOKrENQ5BaUMbYg9UVRYOO3DtDyK3D 6Ggg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709846402; x=1710451202; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FxAW6z2fWfFSrmQ+Ro+a/GGTy69KREURq9bDQwEnpUQ=; b=HocPm4WzauENdLfuzGr2ku04nNmM+EjlNpEgshDftsCq7r6H0GzEDkDPFiH9hnfvrt SW2yEu9NI+4cPM/sDyh3OSNX/aCxPDcCj08hJUjBcuRJuR/Yfwo2QE1yhigES+SK+JDl 071/3xzJbTV2RJKjTbeTyQpKXLgvWl1cVoA5zdFgNJYJQwcoodQdYuiR+nMGKOePh7ng maxpepb07wnDNwsmjJcMrBxn1ycNWJtDk7t0kJ8J3/YwnKxYW+PjE7jDRgYuitb8W6Rv 3gxsKNC8MqzhAPuHMtpMXGM5H/hcgEwV4p0flODuHbbuoc6MO0iEzBh+GBiEatIO8cYr DZZg== X-Forwarded-Encrypted: i=1; AJvYcCXRr89fcBYuO7Y1Fq4cUdojPR3NAOJ3Bvl8SLAInLilsKOyAhhwewMFa3jDFDdPE6bPlUyUUrDq7oq6ofpV18vscVZPLRclAS9C9+0ZAH31MRJH4ZHVScYz+iI0R2RUm4nQ027p4rpiflGQkCg= X-Gm-Message-State: AOJu0Yy67OzBSavPitxKFo0cpXs+Igh+b+AXbBOE5DaAclpVCo6iZATW sGcrnuaJ39J1FNtDwKn9iyTMImwgdZQI6hFO+p5tEIYHhwNJKHAwhjUNhEReY/TA7Q== X-Received: by 2002:a05:651c:204d:b0:2d3:28b3:d9e0 with SMTP id t13-20020a05651c204d00b002d328b3d9e0mr2110144ljo.40.1709846401462; Thu, 07 Mar 2024 13:20:01 -0800 (PST) Received: from rand-ubuntu-development.dl.local (mail.confident.ru. [85.114.29.218]) by smtp.gmail.com with ESMTPSA id k20-20020a2e8894000000b002d2d7f4ac11sm3232995lji.0.2024.03.07.13.20.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 13:20:01 -0800 (PST) From: Rand Deeb To: m@bues.ch Cc: deeb.rand@confident.ru, jonas.gorski@gmail.com, khoroshilov@ispras.ru, kvalo@kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, lvc-project@linuxtesting.org, rand.sec96@gmail.com, voskresenski.stanislav@confident.ru Subject: Re: [PATCH v3] ssb: Fix potential NULL pointer dereference in ssb_device_uevent Date: Fri, 8 Mar 2024 00:19:28 +0300 Message-Id: <20240307211928.170877-1-rand.sec96@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240307192405.34aa9841@barney> References: <20240307192405.34aa9841@barney> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Thu, Mar 7, 2024 at 9:24 PM Michael Büsch wrote: > There is only one reason to eliminate NULL checks: > In extremely performance critical code, if it improves performance > significantly and it is clearly documented that the pointer can never be NULL. > > This is not that case here. This is not critical code. Hi Michael, thank you for your collaboration and feedback. Yes, I agree, this is not critical code, but what's the point of leaving redundant conditions even if they won't make a significant performance difference, regardless of the policy (In other words, as a friendly discussion) ? Please take a look at https://git.kernel.org/netdev/net-next/c/92fc97ae9cfd same situation but it has been applied ! why ? > Having NULL checks is defensive programming. > Removing NULL checks is a hazard. > Not having these checks is a big part of why security sucks in today's software. I understand and respect your point of view as software engineer but it's a matter of design problems which is not our case here. Defensive programming is typically applied when there's a potential risk, but in our scenario, it's impossible for 'dev' to be NULL. If we adopt this approach as a form of defensive programming, we'd find ourselves adding similar conditions to numerous functions and parameters. Moreover, this would unnecessarily complicate the codebase, especially during reviews. For instance, encountering such a condition might lead one to assume that 'dev' could indeed be NULL before reaching this function. That's my viewpoint. > V3 shall be applied, because it fixes a clear bug. Whether this bug can actually > be triggered or not in today's kernel doesn't matter. so would you recommend fix the commit message as Jeff Johnson recommended ? or just keep it as it is ? -- Best Regards Rand Deeb