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 8997357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:52:43+00:00 2026-06-15T23:52:43+00:00

I use vmalloc to allocate a contiguous virtual memory block. I then set all

  • 0

I use vmalloc to allocate a contiguous virtual memory block. I then set all the bytes of this block to 0 by using memset. I then, fill this memory region with a data structure that I created that is 16 bytes in size.

Then, during one of my functions, I place a pointer to one of these structures, and begin to walk down the memory region to find the first 0 byte so that I can place another data structure here. My first pointer correctly gets the previously placed structure, and I can see the address. This is the printout:

point’s filename / //Filename
ffffc9001095b500 //Address

That is the correct memory region for this structure (since I placed it here).

I then increment my pointer, which should take me to memory region ffffc9001095b510,
but instead my pointer comes back with an address of NULL. Why is this?

Here’s the code:

void * check_aux(char * upPath, int index, int location){
struct directory * point;       
int i = 0;
int dirnum = 0;
//int lastaddr;
printk("Inside check_aux\n");   

if(location > 117){
    return NULL;
}
else if(upPath == NULL){
    return NULL;
}
else{
    point = getLocation(index, location);
    printk("This is point's filename %s\n%p\n", point->filename, point);        
    while(point != NULL && dirnum < 16){

        while(point->filename[i] == upPath[i] || (point->filename[i] == 0 && (upPath[i] =='/' || upPath[i] == 0))){
            printk("%c == %c\n", point->filename[i], upPath[i]);
            if(point->filename[i] == 0 && upPath[i] == 0){
                return NULL;
            }
            else if(point->filename[i] == 0 && upPath[i] == '/'){
                if(nodes[point->index].type[0] == 'd'){
                    return check_aux(&upPath[i+1], point->index, 0);
                }
                else{
                    return NULL;
                }


            }
            else{
                i++;
            }

        }
        dirnum++;
        (point++);
    }
    if(dirnum == 16){
        return check_aux(upPath, index, location+1);
    }
    printk("Returning point %p\n", point);
    return point;
}

}

The data struct is defined as

struct directory{
char filename[14];
short index;

};

And filename cannot start with 0.

  • 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-15T23:52:43+00:00Added an answer on June 15, 2026 at 11:52 pm

    You leave the loop in 2 cases:

    • if point is NULL, in which case you return NULL.
    • if dirnum is 16. In which case you call the function recursively, and will also return NULL.

    All other return statements return NULL, too.

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

Sidebar

Related Questions

I want to allocate virtually contiguous range memory so that I can use the
On 32bit x86 platform, if vmalloc() can allocate memory from either ZONE_NORMAL or ZONE_HIGHMEM,
use strict; use Time::HiRes qw[gettimeofday tv_interval]; my $start_index = int(rand(50))+100;#this value is arbitrary for
Use Memcache php class to interact with the memcached. At the beginning all works
Use AES/Rijndael or any symmetric encryption. Encrypt the hidden value using itself as the
Use a hidden field will fix my issue... i got it.. Hi All, I
Use http://jobs.sitesixteen.com/ for reference. I'm using YQL for the city, state auto-complete. IF you
Use trap to capture signals like this: i=-1;while((++i<33)); do trap echo $i >> log.txt
use DBI(); What is causing this insert to fail to err 1, the SELECT
Use case is this: I want to unit test (in browser, QUnit or something

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.