Re: [PATCH 1/2] drm/i915/perf: Fix compiler warning for string truncation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Lionel Landwerlin (2018-02-08 10:18:05)
> Arg... I don't know how this happened.
> I thought we agreed upon using strlcpy()?

The others are using sizeof() + strlcpy. I missed the strlcpy
difference.

char uuid[sizeof(test_config.uuid)] = "...";
memcpy(test_config.uuid, uuid, sizeof(uuid));

would be one way, but that will only warn if the string is too long to
fit into the uuid, and won't warn if we need to pad (but I don't we care
in that situation?)
-Chris
 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux