title: Initializing a member of a struct to a function pointer without knowing the returned type
body: <p>I have this struct:</p>
  
  <pre><code>typedef struct xyz_data {
      void *myfa; &lt;------- correct
      void *myfb; &lt;------- incorrect
  }
  </code></pre>
  
  <p>and this function definition:</p>
  
  <pre><code>asmlinkage ssize_t (*real_sys_read)(unsigned int fd, char __user *buf, size_t count);
  asmlinkage ssize_t hooked_sys_read(unsigned int fd, char __user *buf, size_t count);
  </code></pre>
  
  <p>(as you might be guessing, this will point to the kernel's <code>__NR_read</code>).</p>
  
  <p>Saving <code>hooked_sys_read</code> to <code>*myfa;</code> is as simple as <code>xyz_data_something-&gt;myfa = hooked_sys_read</code>, but what about <code>myfb</code>? I'm not sure <code>xyz_data_something-&gt;myfb = &amp;real_sys_read</code> will work.</p>
  
  <p>I'm hijacking some syscalls (If you're interested in the project, everything is available in GitHub) and each hijacked syscall will use that struct to call the real syscall it belongs to (which will be accessed via <code>*myfb</code>), making use of the returned value.</p>
  
  <p>Keep in mind that each syscall has it's own return type.</p>