I would like to ask whether the following message will pose a potential bug to the program.
Syscall param pwrite(64) points to uninitialised bytes.
What is this problem about and more importantly, will it cause segmentation fault?
I would like to ask whether the following message will pose a potential bug to the program.
Syscall param pwrite(64) points to uninitialised bytes.
What is this problem about and more importantly, will it cause segmentation fault?
Can you post relevant minimal code?
Are you calling write/pwrite, or some other function that could be using it? Find out what part of your source code it comes from, valgrind should report a trace. Then look at what you're attempting to write: you seem to be writing data from the buffer that hasn't been changed, so either you forgot to assign it all with a value or you're passing a wrong length argument...
That's my guess, but that's all I can do without code.
Will it segfault? It might do worse than that. The computer might explode or attack you. The funs of undefined behaviour.
http://219.78.202.86:8080/him.c
http://219.78.202.86:8080/testcase.c (the code with main function)
here is the code. However, since I will power off my computer around 0000(HKT), so it will be not acessible from that time.
Than You.
==4328== Syscall param pwrite64(buf) points to uninitialised byte(s)
==4328== at 0x40DC488: pwrite (pwrite.c:57)
==4328== by 0x8048BFF: swaptocache (in /home/cowcow/Desktop/test)
==4328== by 0x804926E: real_him (in /home/cowcow/Desktop/test)
==4328== by 0x80494B0: case3 (in /home/cowcow/Desktop/test)
==4328== by 0x80494ED: main (in /home/cowcow/Desktop/test)
==4328== Address 0x804d062 is 8194 bytes inside data symbol "buffer"
And is that your internal network?
Not Found
The requested URL /him.c was not found on this server.
Apache/2.2.8 (Win32) PHP/5.2.6 Server at 219.78.202.86 Port 8080
> ==4328== Address 0x804d062 is 8194 bytes inside data symbol "buffer"
Interesting, because 8192 is a popular buffer size.
Seems to me like you overran it.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
The pwrite64() function accepts a pointer (or address) and writes out whatever is at that address.
Writing such data out requires that the data pointed to is initialised (accessing the value of anything that is uninitialised is formally undefined behaviour, according to the C standard). You have presumably passed an uninitialised pointer or array hence the complaint by valgrind.
It's also possible, as Salem suggested, you are writing out more than the buffer (eg buffer is some length, you are outputting more than that length).