Skip to content

Latest commit

 

History

History
47 lines (34 loc) · 1.28 KB

28132-driver-taking-the-size-of-pointer.md

File metadata and controls

47 lines (34 loc) · 1.28 KB
title description keywords ms.date f1_keywords
C28132 Warning
Warning C28132 Taking the size of pointer.
warnings listed WDK PREfast for Drivers
errors listed WDK PREfast for Drivers
04/20/2017
C28132

C28132

warning C28132: Taking the size of pointer

Additional information

This will yield the size of a pointer (4 or 8), not the size of the object pointed to. Dereference the pointer, or if the size of a pointer was intended, use the pointer type or (void *) instead.

The driver is taking the size of a pointer variable, not the size of the value that is pointed to. If the driver needs the size of the pointed-to value, change the code so that it references the value. If the driver actually needs the size of the pointer, take the size of the pointer type (for example, LPSTR, char* or even void*) to clarify that this is the intent.

Example

The following code example elicits this warning.

memset(b, 0, sizeof(b));

The following code example avoids this warning.

memset(b, 0, sizeof(*b));