X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=HACKING;h=89a6b3ad444436732c2bae557f6e37ca5b01782a;hb=a8170e5e97ad17ca169c64ba87ae2f53850dab4c;hp=471cf1d1970959e95ba18aa8abd798bb5240d95b;hpb=cde7fc31dee7a7bac96779f77a21825b187871d3;p=mirror_qemu.git diff --git a/HACKING b/HACKING index 471cf1d197..89a6b3ad44 100644 --- a/HACKING +++ b/HACKING @@ -32,7 +32,7 @@ mandatory for VMState fields. Don't use Linux kernel internal types like u32, __u32 or __le32. -Use target_phys_addr_t for guest physical addresses except pcibus_t +Use hwaddr for guest physical addresses except pcibus_t for PCI addresses. In addition, ram_addr_t is a QEMU internal address space that maps guest RAM physical addresses into an intermediate address space that can map to host virtual address spaces. Generally @@ -91,10 +91,11 @@ emulators. 4. String manipulation -Do not use the strncpy function. According to the man page, it does -*not* guarantee a NULL-terminated buffer, which makes it extremely dangerous -to use. Instead, use functionally equivalent function: -void pstrcpy(char *buf, int buf_size, const char *str) +Do not use the strncpy function. As mentioned in the man page, it does *not* +guarantee a NULL-terminated buffer, which makes it extremely dangerous to use. +It also zeros trailing destination bytes out to the specified length. Instead, +use this similar function when possible, but note its different signature: +void pstrcpy(char *dest, int dest_buf_size, const char *src) Don't use strcat because it can't check for buffer overflows, but: char *pstrcat(char *buf, int buf_size, const char *s)