Re: [PATCH v2] nfsd: avoid undefined signed overflow

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

 



Bernd Petrovitsch wrote:

  Hmm, what is actually wrong with plain-old
  ----  snip  ----
  static bool stateid_generation_after(stateid_t *a, stateid_t *b)
  {
  	return a->si_generation > b->si_generation;
  }
  ----  snip  ----
  ?

It doesn't account for wraparound. Try this:

    unsigned int a = 0xffff0000, b = 0x7fff0000;
    printf("%d %d\n", a > b, (int)(a - b) > 0);

I just realized that I said this needed a comment, then didn't provide one.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux