October 2013:Reputation comes from the company you keep


In the past weeks, I was busy working on my new assignment: H323 protocol stack.
After about two monthes hard working, I can finally say that I almost made it, which means I can figure out the reasons of most of the remained bugs/defects, and can resolve them in time if it is protocol relevant. And, I’d say that it’s really a tough one, gaven the backgroud that all the team memenbers had left Kedacom, I have no one to turn to.

However, lots of mistaken/jokes happened during this period.

One biggest mistake/joke was, I said in a weekly meeting, right in front of all the team members, that doing write operations to an NULL pointer can make the app’s top sections of memory (BSS) wrong…

This brief came from an existing code of H323 stack, which apprearantly wrong:

[cpp]

if ( NULL == m_ptMsgDelay )
{
memset(m_ptMsgDelay, 0, sizeof(m_ptMsgDelay));
}

[/cpp]

I declared it wrong when I first saw line 1:”if ( NULL == m_ptMsgDelay )”.
But I did no more dug on the further codes, because I had tons of codes to read, and I didn’t want to be stucked in some particular lines of code.

When the weekly meeting came, and I didn’t know what to say about, I remenbered this issue, so I brought it out, saying it could lead to write wrong data to an invalid memory section.

Being a programmer for over 10 years, I’ve handled with hundreds of NULL pointer issues. Saying words like this, it’s really out of sense. Even now, I do not know what I was thinking, what I was saying about.

So, yes, I lost all my reputations before gain it. I think this could be a tremendous joke in the whole team, and can be joked all around the company.

Like it or not, it could be a life-time mark for myself. I can also remenber it by joking it around like it or not.

Two lessons:
1. When you see something suspicous, try dig it out.
2. Let it be, if you dont have things to say about.

The good thing is, having nothing valuable to look back, I can look forward now.

20131108 update:

I brought out the codes which I’d made mistake, In the last week’s weekly meeting, to joke how a programmer with over ten years of experience could make such a fault on a knowledge of basis.
But, after a few minutes check & review, I was astonished. Most of the team members were also wrong about the common senses.

So, today, I decide to put it here on my blog, if you happen to see this article, make a test for yourself. If this is the code you need to review, how would you think of it?

[cpp]
typedef struct tagMsgDelay
{
s32 nMesgType;
s32 nSubReq;
s32 nDelayTime;
u32 nReserved;
}TProxyMsg;

TProxyMsg* m_ptMsgType[MAX_MSG_QUEUE];

void InitProxyClient() {
if ( NULL == m_ptMsgDelay )
{
memset(m_ptMsgDelay, 0, sizeof(m_ptMsgDelay));
}
}
[/cpp]

Key point of this code:
1. if ( NULL == m_ptMsgDelay )
2. memset
3. sizeof(m_ptMsgDelay)
4. sizeof(NULL)

Leave a comment

Your email address will not be published. Required fields are marked *