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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 27 Sep 2007 06:26:15 +0000 (UTC)
From:	Shreyansh Jain <shreyansh.jain@...il.com>
To:	linux-kernel@...r.kernel.org
Subject:  Re: try_module_get code understanding

Thanks for you reply, please see inline.

Heiko Carstens <heiko.carstens <at> de.ibm.com> writes:
> 
[snip]
> > static inline int try_module_get(struct module *module){
> >   int ret = 1;   <--- error case when !module
> >     if (module) {
> >          unsigned int cpu = get_cpu();
> >          if (likely(module_is_live(module)))
> >                 local_inc(&module->ref[cpu].count);
> >          else
> >                 ret = 0;   <--- error case
> >          put_cpu();
> >   }
> >   return ret;   <----
> > }
> > ----
[snip]
 
> Somewhere in module.h you have:
> 
> #ifdef MODULE
> #define THIS_MODULE (&__this_module)
> #else  /* !MODULE */
> #define THIS_MODULE ((struct module *)0)
> #endif
> 
> So this just means, that THIS_MODULE is NULL for compiled in modules
> and therefore try_module_get(NULL) succeeds. It's not an error case.

Agreed.

Then what is return value if my module tries to 'get' a module which does not
exist (and is a module, not in-built)? . Is it '1' ?
Or am I imagining a hypothetical scenario which would not exist?

Thanks again for your fast response.
Shreyansh

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists