From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) (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 AD8F91F130B for ; Fri, 12 Dec 2025 19:36:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765568192; cv=none; b=Fs31WK/rYbQyPJ0oNRdCgfqqdxfATykYyLaIv7BjPX7Vf7+gG9TAC6p7MKqxUApFtKtm/gEX1n4FhBxX1tMZm1BV/FVqAIMBb6RxlAmMGKnihqh1MJtp3Z5dvIC8vvgQyNLCu0ghkQmnkyKa1tqDLsisqJGV40RlfsBy8JQZcW8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765568192; c=relaxed/simple; bh=kAJEIijw1h39dwP0oiHddBkEtMnWkioxlFQC1ujPckI=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=T/RaG9QTgm7RZ3edVYWCk2TWuCh54S22ICWRwQNtSBIqFREibZEn7imYiU/fJFuISpk2utQYPTCQrWgUupAlNQCPAysBjCahD15uq/Ai9JV0RoNjHOr+raYfnXxAOcfeuU1S1P6nI/gMUCjbtXwVav34IpBSZAXMoya+Ejum0X0= 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=LJ0iQRwp; arc=none smtp.client-ip=209.85.208.172 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LJ0iQRwp" Received: by mail-lj1-f172.google.com with SMTP id 38308e7fff4ca-37b9d8122fdso12406801fa.3 for ; Fri, 12 Dec 2025 11:36:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765568189; x=1766172989; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=+iAGiWGntUzRzKLCpTz264YmDdwQESuNb3m83qNK0Aw=; b=LJ0iQRwpH8vMlczYW8iOS2F4RRO6qm1YC8mp89fb/XFxb2JVNxiJ5Dxto9q3ZtmFL6 WkI0YtJfspXvTKyeLzh2LdoFZWeyAUs6QhB/NqoivuSXYVkvlp778wHbEtD+OVxXl05L yIPU8gPPEphHO4+kn44hTPniHotK30tt1PfEx06MXW59VJDAC4yR/45aKFPVwKzqqr55 o3og9s9p2mgCPOA6Bt6WRw8E46NKdKJvG/wCup+9cocYl1EtxWl+G08YPbiyq1eTKDWz 5IUl6EhF25KFSbw/c/ofko9QRIzFEAqqz9damLt4sLNGl4rG+2n/qLCbIJ1lDWfc1flt ScaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765568189; x=1766172989; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=+iAGiWGntUzRzKLCpTz264YmDdwQESuNb3m83qNK0Aw=; b=w5UptuCP2G81jImzDSze7O+IQJeQ/ckzxwPtpp8d5kymP9UGGNm7sgahUPu68WjAGC 4IkjvPJZbN5p4lFT7taxdjmb3Dg580nJXqvwScO5i8WlnKkHcxwKJM9/1pEMoxGTzyR/ 5v2wmwRZhZTVHJ914xMTZN9GXDEQqsgS12No/N1k48qS6lbO1YGm6KCxZqnL8VRKRtEt lSSQFGj+05LbbIRFfy8taXdw5BTJXJc2RnaydjX26PhqcoRbjRLPiDMGmCpX+xTz3snK /FiyhG6tM5qRWuzPutkwrss7vR03qJDMLAW6zEsARaiLxXFRvoA3wKyGrYqtPB6Wht1o 2htQ== X-Forwarded-Encrypted: i=1; AJvYcCWREgG5rnnjueqCSak/ofbhMomjvuDQ6K9ScC8rWe+fVOyrqivDeW/QNQf5IfFekg6DvVpwPx2TwDIk6PE=@vger.kernel.org X-Gm-Message-State: AOJu0Yz0VjgA4LmrZnk9Ch5F2ufbIZuUtJcHzjpbUJvD1Iudb/QGn0hB P8hhG29+l/eDtGsj5yl5vFaYGB6z8SzzRLQM4jEuVZdD2dOd7IBJMIpJUi7+Ww== X-Gm-Gg: AY/fxX7dQZGgzzHb+gexnM/CKTJunKW8QiX0LCmndKjQZfi0qbhGC779TXc3IcVySOY 3q8VNoOr18wVCGqNKW8HR2mFmRMUxkrTS+IrlyLaYE3bZkMq37I4qvWj+55lUasVZRLG9GZ6RDw k117qE6LetE6rkQPJMjBPkFiiL1fqeSZxG9dsynbsu6H1l7Fu3VaqfUEtvsFZQNaXgk0KWXMqrY lKTauMuqrpqksvL2vpYP0BOcYgZS3VRKHWlfMovpmiUPYU2ou1Cmkqnif+qJmfzhIaXl/Wj3QGF /hMT4vARlMSa8XXpG1nRLNnLGKZitdEMI+/7oIAB2AzmX2sFTuR7yi7krKddaPy+8OEGahEXTIq hCp+xGS5r9vSvjuxV0wrAbkn2g6jUTFU+gUcGTSbpnFwNE/Mf1tiA5PsG4bpmwqVF4oD7ZpBU5H aCVBrspwV/zgVSstAv8UZCT/y1hEOOXpEfKxNXxgVNstwzj1dY+BST X-Google-Smtp-Source: AGHT+IE4SzG9SEUo36H+/RajRuGXQKEqi8PEHCvRAZiuCC+tFu11I+7qLmwsFCnbEjl5dXnaqDhnFA== X-Received: by 2002:a05:600c:4451:b0:477:9fcf:3ff9 with SMTP id 5b1f17b1804b1-47a8f90f54bmr26022385e9.27.1765560968089; Fri, 12 Dec 2025 09:36:08 -0800 (PST) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47a8f7676ffsm43676465e9.4.2025.12.12.09.36.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Dec 2025 09:36:07 -0800 (PST) Date: Fri, 12 Dec 2025 17:36:03 +0000 From: David Laight To: Simon Horman Cc: kernel test robot , Ilya Krutskih , Andrew Lunn , oe-kbuild-all@lists.linux.dev, Eric Dumazet , Jakub Kicinski , Paolo Abeni , Thomas Gleixner , Ingo Molnar , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org, stable@vger.kernel.org Subject: Re: [PATCH v2] net: fealnx: fix possible 'card_idx' integer overflow in Message-ID: <20251212173603.46f27e9b@pumpkin> In-Reply-To: References: <20251211173035.852756-1-devsec@tpz.ru> <202512121907.n3Bzh2zF-lkp@intel.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) 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-Transfer-Encoding: 7bit On Fri, 12 Dec 2025 14:46:03 +0000 Simon Horman wrote: > On Fri, Dec 12, 2025 at 07:30:04PM +0800, kernel test robot wrote: > > Hi Ilya, > > > > kernel test robot noticed the following build warnings: > > > > [auto build test WARNING on net-next/main] > > [also build test WARNING on net/main linus/master v6.18 next-20251212] > > [If your patch is applied to the wrong git tree, kindly drop us a note. > > And when submitting patch, we suggest to use '--base' as documented in > > https://git-scm.com/docs/git-format-patch#_base_tree_information] > > > > url: https://github.com/intel-lab-lkp/linux/commits/Ilya-Krutskih/net-fealnx-fix-possible-card_idx-integer-overflow-in/20251212-013335 > > base: net-next/main > > patch link: https://lore.kernel.org/r/20251211173035.852756-1-devsec%40tpz.ru > > patch subject: [PATCH v2] net: fealnx: fix possible 'card_idx' integer overflow in > > config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20251212/202512121907.n3Bzh2zF-lkp@intel.com/config) > > compiler: alpha-linux-gcc (GCC) 15.1.0 > > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251212/202512121907.n3Bzh2zF-lkp@intel.com/reproduce) > > > > If you fix the issue in a separate patch/commit (i.e. not just a new version of > > the same patch/commit), kindly add following tags > > | Reported-by: kernel test robot > > | Closes: https://lore.kernel.org/oe-kbuild-all/202512121907.n3Bzh2zF-lkp@intel.com/ > > > > All warnings (new ones prefixed by >>): > > > > drivers/net/ethernet/fealnx.c: In function 'fealnx_init_one': > > >> drivers/net/ethernet/fealnx.c:496:35: warning: '%d' directive writing between 1 and 11 bytes into a region of size 6 [-Wformat-overflow=] > > 496 | sprintf(boardname, "fealnx%d", card_idx); > > | ^~ > > drivers/net/ethernet/fealnx.c:496:28: note: directive argument in the range [-2147483647, 2147483647] > > 496 | sprintf(boardname, "fealnx%d", card_idx); > > | ^~~~~~~~~~ > > drivers/net/ethernet/fealnx.c:496:9: note: 'sprintf' output between 8 and 18 bytes into a destination of size 12 > > 496 | sprintf(boardname, "fealnx%d", card_idx); > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Although I think these new warnings are not strictly for problems > introduced by this patch. They do make me wonder > if it would be best to cap card_index MAX_UNITS and > return an error if that limit is exceeded. The code seems to be written allowing for more than MAX_UNITS 'units'. Actually it all looks pretty broken to me... 'card_idx' is incremented by every call to fealnx_init_one(). That is the pci_driver.probe() function. So every card remove and rescan will increment it. (Is the .probe() even serialised? I can't remember...) Then there is the MODULE_PARAM_DESC() that states that bit 17 of 'options' is the 'full duplex' flag, but the code checks 'options & 0x200'. And I just don't understand the assignment: option = dev->mem_start; The code was like this when Linux created git. David