+2017-04-07  Alan Hayward  <alan.hayward@arm.com>
+
+       * bfin-tdep.c (BFIN_MAX_REGISTER_SIZE): Add.
+       (bfin_pseudo_register_read): Use BFIN_MAX_REGISTER_SIZE.
+       (bfin_pseudo_register_write): Likewise
+
 2017-04-06  Simon Marchi  <simon.marchi@ericsson.com>
 
        * common/ptid.h (struct ptid): Change to...
 
   BFIN_LB1_REGNUM
 };
 
+/* Big enough to hold the size of the largest register in bytes.  */
+#define BFIN_MAX_REGISTER_SIZE 4
 
 struct bfin_frame_cache
 {
 bfin_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
                           int regnum, gdb_byte *buffer)
 {
-  gdb_byte *buf = (gdb_byte *) alloca (MAX_REGISTER_SIZE);
+  gdb_byte buf[BFIN_MAX_REGISTER_SIZE];
   enum register_status status;
 
   if (regnum != BFIN_CC_REGNUM)
 bfin_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
                            int regnum, const gdb_byte *buffer)
 {
-  gdb_byte *buf = (gdb_byte *) alloca (MAX_REGISTER_SIZE);
+  gdb_byte buf[BFIN_MAX_REGISTER_SIZE];
 
   if (regnum != BFIN_CC_REGNUM)
     internal_error (__FILE__, __LINE__,