Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8426655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:35:20+00:00 2026-06-10T04:35:20+00:00

In my kernel module the read function is as follows: ssize_t aes_read(struct file *filp,

  • 0

In my kernel module the read function is as follows:

ssize_t aes_read(struct file *filp, char *buf, size_t count, loff_t *f_pos) { 

  unsigned long aes_reg[4];
  aes_reg[0] = leon_load_reg(output_mem_loc);
  aes_reg[1] = leon_load_reg(output_mem_loc+4);
  aes_reg[2] = leon_load_reg(output_mem_loc+8);
  aes_reg[3] = leon_load_reg(output_mem_loc+12);
  copy_to_user(buf, (char *)aes_reg, 16);
  ....

And it appears in the kernel module that buf is being set properly. On the user space side I have written this:

int main(int argc, char* argv[]){
    FILE *fpaes;
    char *str;
    int buf[4];

    fpaes = fopen("/dev/aes", "r");
    fread(str, 16, 1, fpaes);
    p_long = (unsigned long *)str;
    ....

But str is not being updated with the values I expect. Am I allowed to do an fread in this way or am I way off?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T04:35:21+00:00Added an answer on June 10, 2026 at 4:35 am

    str is not initialized in your program. Accessing *str is undefined behavior.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a kernel module that needs to read the value of bitrate from
I am trying to write a /proc file created by a loadable kernel module.
I'm trying to simply read the kernel ring buffer from a kernel module. Also
I have a kernel module that provides data to a userland process through read().
I'm writing a Linux kernel module that needs to open and read files. What's
I'm trying to make a linux kernel module, which supports open, close, read and
I'm writing a kernel module that needs to read the value of bitrate from
I have developed a kernel module (Android) which provides me: PCM 16-bit 48000 Hz
I am writing a kernel module and it is about reading and writing MSRs.
Compiling a kernel module on 32-Bit Linux kernel results in __udivdi3 [mymodule.ko] undefined! __umoddi3

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.