x86/mm/mem_encrypt_identity : fix error useage to sizeof
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 8 lines · On Mon, 7 Jan 2019, [email protected] wrote:
Quoted 6 lines
Quoted 1 line
Fix error usage to sizeof. It should not use sizeof to pointer.
.... because?
The commit message needs to explain what the potential issue could be and why it doesn't matter in this case.
I see the definition of
pte_tmay be more than sizeof(unsigned long). So I thinksizeof(pte_t)is safer.
What exactly is the difference between:
pte_t *p; sizeof(*p)
and
sizeof(pte_t)
and what is safer about the latter?
Answer: No difference and nothing is safer because it's exactly the same.
In general we use sizeof(*p) simply because when the data type of p changes you don't have to update the code, it just works and stays correct.
Thanks,
tglx
Quoted 17 lines · Thomas Gleixner
Quoted 8 lines · On Mon, 7 Jan 2019, [email protected] wrote:
Quoted 6 lines
Quoted 1 line
Fix error usage to sizeof. It should not use sizeof to pointer.
.... because?
The commit message needs to explain what the potential issue could be and why it doesn't matter in this case.
I see the definition of
pte_tmay be more than sizeof(unsigned long). So I thinksizeof(pte_t)is safer.What exactly is the difference between:
pte_t *p; sizeof(*p)
Quoted 5 lines
and
sizeof(pte_t)and what is safer about the latter?
Please note that the current code is using sizeof(p) instead of sizeof(*p).
And this is really different for X86_32 PAE.
Juergen
Quoted 10 lines
Answer: No difference and nothing is safer because it's exactly the same.
In general we use
sizeof(*p)simply because when the data type of p changes you don't have to update the code, it just works and stays correct.Thanks,
tglx
Quoted 18 lines · Juergen Gross
Quoted 17 lines · Thomas Gleixner
Quoted 8 lines · On Mon, 7 Jan 2019, [email protected] wrote:
Quoted 6 lines
Quoted 1 line
Fix error usage to sizeof. It should not use sizeof to pointer.
.... because?
The commit message needs to explain what the potential issue could be and why it doesn't matter in this case.
I see the definition of
pte_tmay be more than sizeof(unsigned long). So I thinksizeof(pte_t)is safer.What exactly is the difference between:
pte_t *p; sizeof(*p)
Quoted 7 lines
Quoted 5 lines
and
sizeof(pte_t)and what is safer about the latter?
Please note that the current code is using sizeof(p) instead of
sizeof(*p).
Ooops. That's wrong indeed, but we should not change it to sizeof(pte_t) and change it to sizeof(*p) instead.
Thanks,
tglx
Quoted 21 lines · Thomas Gleixner
Quoted 20 lines · Juergen Gross
Quoted 19 lines · Thomas Gleixner
Quoted 8 lines · On Mon, 7 Jan 2019, [email protected] wrote:
Quoted 6 lines
Quoted 1 line
Fix error usage to sizeof. It should not use sizeof to pointer.
.... because?
The commit message needs to explain what the potential issue could be and why it doesn't matter in this case.
I see the definition of
pte_tmay be more than sizeof(unsigned long). So I thinksizeof(pte_t)is safer.What exactly is the difference between:
pte_t *p; sizeof(*p)and
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
sizeof(pte_t)and what is safer about the latter?
Please note that the current code is using sizeof(p) instead of
sizeof(*p).Ooops. That's wrong indeed, but we should not change it to
sizeof(pte_t)and change it tosizeof(*p)instead.
And that's what the patch does.
Juergen
Quoted 21 lines · Thomas Gleixner
Quoted 20 lines · Juergen Gross
Quoted 19 lines · Thomas Gleixner
Quoted 8 lines · On Mon, 7 Jan 2019, [email protected] wrote:
Quoted 6 lines
Quoted 1 line
Fix error usage to sizeof. It should not use sizeof to pointer.
.... because?
The commit message needs to explain what the potential issue could be and why it doesn't matter in this case.
I see the definition of
pte_tmay be more than sizeof(unsigned long). So I thinksizeof(pte_t)is safer.What exactly is the difference between:
pte_t *p; sizeof(*p)and
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
sizeof(pte_t)and what is safer about the latter?
Please note that the current code is using sizeof(p) instead of
sizeof(*p).Ooops. That's wrong indeed, but we should not change it to
sizeof(pte_t)and change it tosizeof(*p)instead.
Which is what the patch actually does. Just the above reply:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
So I think
sizeof(pte_t)is safer.
confused the hell out of me. -ENOTENOUGHCOFFEE