it's basically a two step process. first you have to find all the bad function pointer casts, second you have to fix them properly (removing the cast itself won't be enough, programmers use that only to shut up the compiler after all). the first step can be mostly automated (not part of the public RAP offering) or done by manual auditing (analysing RAP reports from runtime detection can help pinpoint bad code constructs, e.g., it often happens that RAP reports a problem on a function pointer loaded from an ops structure and by looking at the initializer of the given ops structure one finds even more bad casts, just look at what i had to fix in the linux NFS code for an example
).
fixing a bad fptr cast involves finding out what type is used on the indirect call and the types of all possible target functions. once you have that data you'll have to settle on a common type (one typical case i ran across a lot is that the fptr passes a void* whereas the target functions take a specialized pointer) and fix up all the target functions accordingly. again looking at some of the fixes i made in linux would probably help explain best what is needed to do here.
there's also some finesse possible in choosing the common type, this is what i referred to as 'type diversification' in my H2HC slides. going with the void* vs. specialized pointer example, the obvious and less tedious way of fixing it is to choose the void* as the common type for the given function parameter and do a type cast to the specialized pointer inside each target function. the better way (and i'm guilty of not doing it myself, but i'd already spent 2 months just to fix up linux the lazy way) is to create a new union type with all the possible pointer types as fields in it and choose the union type as the common type, not void*. this will in turn improve the diversity of the type hash at no expense of performance and perhaps even provide better documentation for the given function pointer and its target functions.
another, much less likely cause for a type hash mismatch is when you have indirectly called functions implemented in assembly (e.g., the linux arch specific crypto code). in such cases you'll have to modify the prologue of functions to emit the type hash before the first instruction (again, you'll find examples in PaX).