I'm passing in an uchar array to my kernel then trying to cast to a struct. The GPU driver crashes after a few frames. Here's the OpenCL code. I've stripped out everything else to simplify it and it still crashes. What am I missing?

typedef struct
uchar r, g, b;
} Pixel;

__kernel void main (__global uchar* framebuffer, int width, int height)
int index = get_global_id(1) * width + get_global_id(0);
Pixel* p = (Pixel* )&framebuffer[index * 3];
p->r = 255;
p->g = 0;
p->b = 0;