From: Ron Michael Khu <ronkhu@ntsp.nec.co.jp>
To: p.boehm@d-trust.net
Cc: Jan-Benedict Glaw <jbglaw@lug-owl.de>,
linux-c-programming@vger.kernel.org
Subject: Re: Antwort: Re: Antwort: Re: -EFAULT during freeing a pointer to a structure
Date: Fri, 08 Oct 2004 21:59:58 +0800 [thread overview]
Message-ID: <41669D5E.1050402@hq.ntsp.nec.co.jp> (raw)
In-Reply-To: <OF9FBCFEF1.D1EE727C-ONC1256F27.0043E708@bln.d-trust.de>
Err.. at least two individuals have already tried to explain it you...
for test two, maybe there's somesort of a glib technicality that made u
get away
with writing outside out of the limits u have alloted for ur datastruct...
but it doesnt mean if u're getting no errors when using even values for
MAXNUM(or factors of 4 for that matter),
that there's nothing wrong with ur loop...(and there is... almost
everyone in this list will point it out to you..)
I may not know how u got away with it by using even values for maxnum,
but almost everbody knows that an array created with N elements/slots in
C,C++ or in java
could only be safely accessed/manipulated via the indices 0...N-1
(unless if u're an expert in memory manipulation)
p.boehm@d-trust.net wrote:
>sorry, but it isn't a problem of loop. check this while running the prog...
>
>test one:
>
> #define MAXNUM 7
> compile it and run ...
> you'll see while freeing ptr->next[0] an -EFAULT occours.
>
>test two:
>
> #define MAXMUM 8
> compile it and run ...
> you'll see freeing ptr->next[0] works fine.
>
>my question: why it is so.
>
>thanks
>pb
>
>-
>To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
>
>
next prev parent reply other threads:[~2004-10-08 13:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-08 12:27 Antwort: Re: Antwort: Re: -EFAULT during freeing a pointer to a structure p.boehm
2004-10-08 12:43 ` Jan-Benedict Glaw
2004-10-08 13:59 ` Ron Michael Khu [this message]
2004-10-08 13:59 ` Jan-Benedict Glaw
2004-10-08 14:07 ` Ron Michael Khu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=41669D5E.1050402@hq.ntsp.nec.co.jp \
--to=ronkhu@ntsp.nec.co.jp \
--cc=jbglaw@lug-owl.de \
--cc=linux-c-programming@vger.kernel.org \
--cc=p.boehm@d-trust.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).