From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Subject: Re: [PATCH 06/11] sysctl: Add size to register_net_sysctl function Date: Wed, 21 Jun 2023 13:49:54 +0300 Message-ID: References: <20230621091000.424843-1-j.granados@samsung.com> <20230621091000.424843-7-j.granados@samsung.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="ZFMDZBc9cnLbyP1u" Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687344600; x=1689936600; 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=fSRkwHLFq+2I9Xiyi/hU6wMpRwozZdsPaoeIOTE25yg=; b=AIsj2vEdz+Fc9Jy19U2Q4+7jk5CdnnBRAq8EU0/qgIBKasDy/i9F7ZXwuxvu/FIk+V e/sUJHlgDgR4Qx2Oh1t5R17vdDFqF/9Ly0AVSK9zUVBFtxeRPEJfGRY1Ks9BJsa7NWkf GXQKQBgxImLcLHozIYWaaIqJ2GrVDZ8vDZMAG4ZNWlYOBv1zbniTnw6kcMxllyCdLRPM ZQ4LPyPa8TOuuqU/g5NEtzVey08OWckHaORybMu3dXpLsx3EAMUOJp98YetCTODsSvBK UGnxHZVFuD2xpLdXg7xgTBB0HXflRT1SIPGFL3SgcodXnvQYRGYsUcq+78aAj0lpxCAJ /6yw== List-Id: List-Subscribe: List-Unsubscribe: Content-Disposition: inline In-Reply-To: To: Joel Granados Cc: mcgrof@kernel.org, Jason Gunthorpe , Leon Romanovsky , David Ahern , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Joerg Reuter , Ralf Baechle , Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , Roopa Prabhu , Nikolay Aleksandrov , Alexander Aring , Stefan Schmidt , Miquel Raynal , Steffen Klassert , Herbert Xu , Matthieu Baerts , Mat Martineau , Simon Horman , Julian --ZFMDZBc9cnLbyP1u Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Jun 21, 2023 at 12:47:30PM +0300, Dan Carpenter wrote: > The patchset doesn't include the actual interesting changes, just a > bunch of mechanical prep work. > I was wrong here, the patchset just hadn't all hit the mailing lists. I can't apply this patchset to anything. I tried linux-next, net, and net-next. So it's hard to review. It looks like ensure_safe_net_sysctl() never got update to use table_size... You could easily write a static checker test to print a warning any time that ->procname is checked for NULL. I have attached a Smatch check. You would need to added to check_list.h and recompile. net/sysctl_net.c:130 ensure_safe_net_sysctl() warn: checking ->procname 'ent->procname' regards, dan carpenter --ZFMDZBc9cnLbyP1u Content-Type: text/x-csrc; charset=us-ascii Content-Disposition: attachment; filename="check_checking_procname.c" #include "smatch.h" #include "smatch_slist.h" static int my_id; static void match_condition(struct expression *expr) { char *member_name; if (expr->type == EXPR_COMPARE) return; member_name = get_member_name(expr); if (!member_name) return; if (strcmp(member_name, "(struct ctl_table)->procname") == 0) sm_warning("checking ->procname '%s'", expr_to_str(expr)); } void check_checking_procname(int id) { my_id = id; add_hook(&match_condition, CONDITION_HOOK); } --ZFMDZBc9cnLbyP1u--