lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202312181258.ae2vsFwE-lkp@intel.com>
Date: Mon, 18 Dec 2023 12:10:10 +0800
From: kernel test robot <lkp@...el.com>
To: Daniel Hill <daniel@...o.nz>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
	Kent Overstreet <kmo@...erainc.com>
Subject: fs/bcachefs/mean_and_variance.c:67: warning: Function parameter or
 struct member 's' not described in 'mean_and_variance_get_mean'

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   ceb6a6f023fd3e8b07761ed900352ef574010bcb
commit: 92095781e0f607e735971c1a6462ca6dad8826d2 bcachefs: Mean and variance
date:   8 weeks ago
config: i386-buildonly-randconfig-002-20231218 (https://download.01.org/0day-ci/archive/20231218/202312181258.ae2vsFwE-lkp@intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231218/202312181258.ae2vsFwE-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 <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312181258.ae2vsFwE-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> fs/bcachefs/mean_and_variance.c:67: warning: Function parameter or struct member 's' not described in 'mean_and_variance_get_mean'
>> fs/bcachefs/mean_and_variance.c:78: warning: Function parameter or struct member 's1' not described in 'mean_and_variance_get_variance'
>> fs/bcachefs/mean_and_variance.c:94: warning: Function parameter or struct member 's' not described in 'mean_and_variance_get_stddev'
>> fs/bcachefs/mean_and_variance.c:108: warning: Function parameter or struct member 's' not described in 'mean_and_variance_weighted_update'
>> fs/bcachefs/mean_and_variance.c:108: warning: Function parameter or struct member 'x' not described in 'mean_and_variance_weighted_update'
   fs/bcachefs/mean_and_variance.c:108: warning: Excess function parameter 's1' description in 'mean_and_variance_weighted_update'
   fs/bcachefs/mean_and_variance.c:108: warning: Excess function parameter 's2' description in 'mean_and_variance_weighted_update'
>> fs/bcachefs/mean_and_variance.c:134: warning: Function parameter or struct member 's' not described in 'mean_and_variance_weighted_get_mean'
>> fs/bcachefs/mean_and_variance.c:143: warning: Function parameter or struct member 's' not described in 'mean_and_variance_weighted_get_variance'
>> fs/bcachefs/mean_and_variance.c:153: warning: Function parameter or struct member 's' not described in 'mean_and_variance_weighted_get_stddev'


vim +67 fs/bcachefs/mean_and_variance.c

    62	
    63	/**
    64	 * mean_and_variance_get_mean() - get mean from @s
    65	 */
    66	s64 mean_and_variance_get_mean(struct mean_and_variance s)
  > 67	{
    68		return s.n ? div64_u64(s.sum, s.n) : 0;
    69	}
    70	EXPORT_SYMBOL_GPL(mean_and_variance_get_mean);
    71	
    72	/**
    73	 * mean_and_variance_get_variance() -  get variance from @s1
    74	 *
    75	 * see linked pdf equation 12.
    76	 */
    77	u64 mean_and_variance_get_variance(struct mean_and_variance s1)
  > 78	{
    79		if (s1.n) {
    80			u128_u s2 = u128_div(s1.sum_squares, s1.n);
    81			u64  s3 = abs(mean_and_variance_get_mean(s1));
    82	
    83			return u128_lo(u128_sub(s2, u128_square(s3)));
    84		} else {
    85			return 0;
    86		}
    87	}
    88	EXPORT_SYMBOL_GPL(mean_and_variance_get_variance);
    89	
    90	/**
    91	 * mean_and_variance_get_stddev() - get standard deviation from @s
    92	 */
    93	u32 mean_and_variance_get_stddev(struct mean_and_variance s)
  > 94	{
    95		return int_sqrt64(mean_and_variance_get_variance(s));
    96	}
    97	EXPORT_SYMBOL_GPL(mean_and_variance_get_stddev);
    98	
    99	/**
   100	 * mean_and_variance_weighted_update() - exponentially weighted variant of mean_and_variance_update()
   101	 * @s1: ..
   102	 * @s2: ..
   103	 *
   104	 * see linked pdf: function derived from equations 140-143 where alpha = 2^w.
   105	 * values are stored bitshifted for performance and added precision.
   106	 */
   107	void mean_and_variance_weighted_update(struct mean_and_variance_weighted *s, s64 x)
 > 108	{
   109		// previous weighted variance.
   110		u8 w		= s->weight;
   111		u64 var_w0	= s->variance;
   112		// new value weighted.
   113		s64 x_w		= x << w;
   114		s64 diff_w	= x_w - s->mean;
   115		s64 diff	= fast_divpow2(diff_w, w);
   116		// new mean weighted.
   117		s64 u_w1	= s->mean + diff;
   118	
   119		if (!s->init) {
   120			s->mean = x_w;
   121			s->variance = 0;
   122		} else {
   123			s->mean = u_w1;
   124			s->variance = ((var_w0 << w) - var_w0 + ((diff_w * (x_w - u_w1)) >> w)) >> w;
   125		}
   126		s->init = true;
   127	}
   128	EXPORT_SYMBOL_GPL(mean_and_variance_weighted_update);
   129	
   130	/**
   131	 * mean_and_variance_weighted_get_mean() - get mean from @s
   132	 */
   133	s64 mean_and_variance_weighted_get_mean(struct mean_and_variance_weighted s)
 > 134	{
   135		return fast_divpow2(s.mean, s.weight);
   136	}
   137	EXPORT_SYMBOL_GPL(mean_and_variance_weighted_get_mean);
   138	
   139	/**
   140	 * mean_and_variance_weighted_get_variance() -- get variance from @s
   141	 */
   142	u64 mean_and_variance_weighted_get_variance(struct mean_and_variance_weighted s)
 > 143	{
   144		// always positive don't need fast divpow2
   145		return s.variance >> s.weight;
   146	}
   147	EXPORT_SYMBOL_GPL(mean_and_variance_weighted_get_variance);
   148	
   149	/**
   150	 * mean_and_variance_weighted_get_stddev() - get standard deviation from @s
   151	 */
   152	u32 mean_and_variance_weighted_get_stddev(struct mean_and_variance_weighted s)
 > 153	{
   154		return int_sqrt64(mean_and_variance_weighted_get_variance(s));
   155	}
   156	EXPORT_SYMBOL_GPL(mean_and_variance_weighted_get_stddev);
   157	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ