SVNews r327453

NOTE: This service is experimental and subject to change! Use at your own risk!

2017-12-31 22:43:24 - r327453 by ian (ian)

Complete list of files affected by revision r327453:

(Note: At the moment, these links point to ViewVC on They are probably slow. Do not overuse.)

  History   Contents   Diff   MODIFY   /head/stand/libsa/stand.h  
  History   Contents   Diff   MODIFY   /head/sys/sys/libkern.h  

Commit message:

Add a validbcd() routine that uses the bcd2bin_data[] array and returns a
bool indicating whether the input value represents a valid BCD byte.

The existing bcd2bin() routine will KASSERT if asked to convert a bad value,
but sometimes the kernel has to handle BCD data from untrusted sources, so
this will provide a mechanism to validate data before attempting conversion.

This would be have easier/cleaner if the bcd2bin_data[] array contained an
out-of-range value (such as 0xff) in the infill locations that aren't valid,
but it's a global symbol that might be referenced by out-of-tree code
relying on the current scheme, so I'm leaving that alone.


Powered by Python FreeBSD support by secnetix GmbH & Co. KG

Page generated in 31 ms, 2 files printed. Current time is 2018-04-20 13:20:01. All times are in UTC/GMT.