Skip to contentSkip to conversation

ktime: minor: ktime_to_timespec_cond: add __must_check prefix

PATCH In review Daniel Borkmann 2 participants 2 messages May 16, 2013 – May 28, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ktime: minor: ktime_to_timespec_cond: add __must_check prefix

The function is currently mainly used in the networking code and if others start using it, they must check the result, otherwise it cannot be determined if the timespec conversion suceeded. Currently no user lacks this check, but make future users aware of a possible misusage.

---
 include/linux/ktime.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/ktime.h +2 -1
index bbca128..cededfd 100644
@@ -338,7 +338,8 @@ extern ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs);
  *
  * Returns true if there was a successful conversion, false if kt was 0.
  */
-static inline bool ktime_to_timespec_cond(const ktime_t kt, struct timespec *ts)
+static inline __must_check bool ktime_to_timespec_cond(const ktime_t kt,
+						       struct timespec *ts)
 {
 	if (kt.tv64) {
 		*ts = ktime_to_timespec(kt);
Signature · 1 line
1.7.11.7
#1 lore raw
Quoted 7 lines · Daniel Borkmann

The function is currently mainly used in the networking code and if others start using it, they must check the result, otherwise it cannot be determined if the timespec conversion suceeded. Currently no user lacks this check, but make future users aware of a possible misusage.

I've got this queued for 3.11. Sorry for being slow to pick this up!

thanks!
-john