*     lifetime use of the sysctl.
  * @table_name: The name of sysctl table, only used for log printing when
  *              registration fails
+ * @table_size: The number of elements in table
  *
  * The sysctl interface is used by userspace to query or modify at runtime
  * a predefined value set on a variable. These variables however have default
  * Context: if your base directory does not exist it will be created for you.
  */
 void __init __register_sysctl_init(const char *path, struct ctl_table *table,
-                                const char *table_name)
+                                const char *table_name, size_t table_size)
 {
-       int count = 0;
-       struct ctl_table *entry;
-       struct ctl_table_header t_hdr, *hdr;
-
-       t_hdr.ctl_table = table;
-       list_for_each_table_entry(entry, (&t_hdr))
-               count++;
-       hdr = register_sysctl_sz(path, table, count);
+       struct ctl_table_header *hdr = register_sysctl_sz(path, table, table_size);
 
        if (unlikely(!hdr)) {
                pr_err("failed when register_sysctl_sz %s to %s\n", table_name, path);
 
 
 extern int sysctl_init_bases(void);
 extern void __register_sysctl_init(const char *path, struct ctl_table *table,
-                                const char *table_name);
-#define register_sysctl_init(path, table) __register_sysctl_init(path, table, #table)
+                                const char *table_name, size_t table_size);
+#define register_sysctl_init(path, table)      \
+       __register_sysctl_init(path, table, #table, ARRAY_SIZE(table))
 extern struct ctl_table_header *register_sysctl_mount_point(const char *path);
 
 void do_sysctl_args(void);